pub struct PhoneticProperties { /* private fields */ }Expand description
Display properties attached to a phonetic string item.
Implementations§
Source§impl PhoneticProperties
impl PhoneticProperties
Sourcepub const fn new(font_id: u32) -> Self
pub const fn new(font_id: u32) -> Self
Constructs properties that reference one workbook font record.
Examples found in repository?
examples/write_phonetic_workbook.rs (line 23)
11fn main() -> Result<(), Box<dyn Error>> {
12 let output = env::args_os()
13 .nth(1)
14 .map(PathBuf::from)
15 .ok_or("usage: write_phonetic_workbook <output.xlsx>")?;
16 let mut draft = WorkbookDraft::new();
17 let sheet_id = draft.workbook().sheets()[0].id();
18 let runs = vec![
19 PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "あした")?,
20 PhoneticRun::new(PhoneticTextRange::new(3, 5)?, "がっこう")?,
21 ];
22 let options = PhoneticWriteOptions::show().with_properties(
23 PhoneticProperties::new(0)
24 .with_phonetic_type(PhoneticType::Hiragana)
25 .with_alignment(PhoneticAlignment::Center),
26 );
27 draft.set_annotated_text(
28 sheet_id,
29 CellAddress::from_a1("A1")?,
30 "明日は学校へ行く",
31 runs,
32 options,
33 )?;
34 draft.set_annotated_text(
35 sheet_id,
36 CellAddress::from_a1("A2")?,
37 "😀A",
38 vec![PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "え")?],
39 PhoneticWriteOptions::show(),
40 )?;
41 draft.set_annotated_text(
42 sheet_id,
43 CellAddress::from_a1("A3")?,
44 "か\u{3099}",
45 vec![PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "が")?],
46 PhoneticWriteOptions::show(),
47 )?;
48 draft.set_frozen_pane(sheet_id, FrozenPane::new(1, 1)?)?;
49
50 let calculation = calculate_workbook(draft.workbook(), CalculationOptions::default());
51 write_xlsx_draft_path(
52 &draft,
53 &calculation,
54 output,
55 RecalculationWriteOptions::default(),
56 )?;
57 Ok(())
58}Sourcepub const fn effective_font_id(&self) -> u32
pub const fn effective_font_id(&self) -> u32
Returns the font identifier a consumer can safely resolve.
A malformed source reference is preserved by Self::font_id while this accessor falls
back to the workbook’s default font record (0).
Sourcepub const fn phonetic_type(&self) -> Option<PhoneticType>
pub const fn phonetic_type(&self) -> Option<PhoneticType>
Returns the requested phonetic character conversion, when explicitly declared.
Sourcepub const fn alignment(&self) -> Option<PhoneticAlignment>
pub const fn alignment(&self) -> Option<PhoneticAlignment>
Returns the requested phonetic alignment, when explicitly declared.
Sourcepub const fn with_phonetic_type(self, phonetic_type: PhoneticType) -> Self
pub const fn with_phonetic_type(self, phonetic_type: PhoneticType) -> Self
Replaces the explicit phonetic character conversion.
Examples found in repository?
examples/write_phonetic_workbook.rs (line 24)
11fn main() -> Result<(), Box<dyn Error>> {
12 let output = env::args_os()
13 .nth(1)
14 .map(PathBuf::from)
15 .ok_or("usage: write_phonetic_workbook <output.xlsx>")?;
16 let mut draft = WorkbookDraft::new();
17 let sheet_id = draft.workbook().sheets()[0].id();
18 let runs = vec![
19 PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "あした")?,
20 PhoneticRun::new(PhoneticTextRange::new(3, 5)?, "がっこう")?,
21 ];
22 let options = PhoneticWriteOptions::show().with_properties(
23 PhoneticProperties::new(0)
24 .with_phonetic_type(PhoneticType::Hiragana)
25 .with_alignment(PhoneticAlignment::Center),
26 );
27 draft.set_annotated_text(
28 sheet_id,
29 CellAddress::from_a1("A1")?,
30 "明日は学校へ行く",
31 runs,
32 options,
33 )?;
34 draft.set_annotated_text(
35 sheet_id,
36 CellAddress::from_a1("A2")?,
37 "😀A",
38 vec![PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "え")?],
39 PhoneticWriteOptions::show(),
40 )?;
41 draft.set_annotated_text(
42 sheet_id,
43 CellAddress::from_a1("A3")?,
44 "か\u{3099}",
45 vec![PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "が")?],
46 PhoneticWriteOptions::show(),
47 )?;
48 draft.set_frozen_pane(sheet_id, FrozenPane::new(1, 1)?)?;
49
50 let calculation = calculate_workbook(draft.workbook(), CalculationOptions::default());
51 write_xlsx_draft_path(
52 &draft,
53 &calculation,
54 output,
55 RecalculationWriteOptions::default(),
56 )?;
57 Ok(())
58}Sourcepub const fn with_alignment(self, alignment: PhoneticAlignment) -> Self
pub const fn with_alignment(self, alignment: PhoneticAlignment) -> Self
Replaces the explicit phonetic alignment.
Examples found in repository?
examples/write_phonetic_workbook.rs (line 25)
11fn main() -> Result<(), Box<dyn Error>> {
12 let output = env::args_os()
13 .nth(1)
14 .map(PathBuf::from)
15 .ok_or("usage: write_phonetic_workbook <output.xlsx>")?;
16 let mut draft = WorkbookDraft::new();
17 let sheet_id = draft.workbook().sheets()[0].id();
18 let runs = vec![
19 PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "あした")?,
20 PhoneticRun::new(PhoneticTextRange::new(3, 5)?, "がっこう")?,
21 ];
22 let options = PhoneticWriteOptions::show().with_properties(
23 PhoneticProperties::new(0)
24 .with_phonetic_type(PhoneticType::Hiragana)
25 .with_alignment(PhoneticAlignment::Center),
26 );
27 draft.set_annotated_text(
28 sheet_id,
29 CellAddress::from_a1("A1")?,
30 "明日は学校へ行く",
31 runs,
32 options,
33 )?;
34 draft.set_annotated_text(
35 sheet_id,
36 CellAddress::from_a1("A2")?,
37 "😀A",
38 vec![PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "え")?],
39 PhoneticWriteOptions::show(),
40 )?;
41 draft.set_annotated_text(
42 sheet_id,
43 CellAddress::from_a1("A3")?,
44 "か\u{3099}",
45 vec![PhoneticRun::new(PhoneticTextRange::new(0, 2)?, "が")?],
46 PhoneticWriteOptions::show(),
47 )?;
48 draft.set_frozen_pane(sheet_id, FrozenPane::new(1, 1)?)?;
49
50 let calculation = calculate_workbook(draft.workbook(), CalculationOptions::default());
51 write_xlsx_draft_path(
52 &draft,
53 &calculation,
54 output,
55 RecalculationWriteOptions::default(),
56 )?;
57 Ok(())
58}Trait Implementations§
Source§impl Clone for PhoneticProperties
impl Clone for PhoneticProperties
Source§fn clone(&self) -> PhoneticProperties
fn clone(&self) -> PhoneticProperties
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PhoneticProperties
impl Debug for PhoneticProperties
impl Eq for PhoneticProperties
Source§impl Hash for PhoneticProperties
impl Hash for PhoneticProperties
Source§impl Ord for PhoneticProperties
impl Ord for PhoneticProperties
Source§fn cmp(&self, other: &PhoneticProperties) -> Ordering
fn cmp(&self, other: &PhoneticProperties) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PhoneticProperties
impl PartialEq for PhoneticProperties
Source§impl PartialOrd for PhoneticProperties
impl PartialOrd for PhoneticProperties
impl StructuralPartialEq for PhoneticProperties
Auto Trait Implementations§
impl Freeze for PhoneticProperties
impl RefUnwindSafe for PhoneticProperties
impl Send for PhoneticProperties
impl Sync for PhoneticProperties
impl Unpin for PhoneticProperties
impl UnsafeUnpin for PhoneticProperties
impl UnwindSafe for PhoneticProperties
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.