pub struct CellAnchorPoint {
pub column: u32,
pub column_offset_emu: i64,
pub row: u32,
pub row_offset_emu: i64,
}Expand description
One corner of a cell-anchored drawing range (<xdr:from>/<xdr:to>, CT_Marker) — a cell
reference (0-based column/row, matching this crate’s own 0-based Row/column conventions
elsewhere) plus an EMU offset within that cell, letting a picture/chart start or end partway
through a cell rather than exactly on a gridline.
Fields§
§column: u32§column_offset_emu: i64§row: u32§row_offset_emu: i64Implementations§
Source§impl CellAnchorPoint
impl CellAnchorPoint
Sourcepub fn new(column: u32, row: u32) -> CellAnchorPoint
pub fn new(column: u32, row: u32) -> CellAnchorPoint
A corner exactly on the gridline at (column, row), no offset.
Examples found in repository?
examples/xlsx_images_and_charts.rs (line 29)
21fn main() -> office_toolkit::Result<()> {
22 let path = output_path("xlsx_images_and_charts.xlsx");
23 let image_bytes = std::fs::read(image_fixture_path())?;
24
25 let picture = SheetPicture::new(image_bytes, PictureFormat::Png).with_name("Test image");
26 let picture_sheet = Sheet::new("Picture")
27 .with_row(Row::new().with_text("The picture is anchored to cell A1:"))
28 .with_drawing(SheetDrawing::new().with_anchor(DrawingAnchor::new(
29 CellAnchorPoint::new(0, 1),
30 CellAnchorPoint::new(2, 6),
31 DrawingObject::Picture(Box::new(picture)),
32 )));
33
34 let chart = SheetChart::new(sample_chart_space()).with_name("Quarterly revenue");
35 let chart_sheet = Sheet::new("Chart")
36 .with_row(Row::new().with_text("A bar chart is anchored below:"))
37 .with_drawing(SheetDrawing::new().with_anchor(DrawingAnchor::new(
38 CellAnchorPoint::new(0, 1),
39 CellAnchorPoint::new(6, 16),
40 DrawingObject::Chart(Box::new(chart)),
41 )));
42
43 let workbook = Workbook::new()
44 .with_sheet(picture_sheet)
45 .with_sheet(chart_sheet);
46 workbook.save_to_file(&path)?;
47 println!("Wrote {}", path.display());
48 Ok(())
49}pub fn with_column_offset_emu(self, offset: i64) -> CellAnchorPoint
pub fn with_row_offset_emu(self, offset: i64) -> CellAnchorPoint
Trait Implementations§
Source§impl Clone for CellAnchorPoint
impl Clone for CellAnchorPoint
Source§fn clone(&self) -> CellAnchorPoint
fn clone(&self) -> CellAnchorPoint
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 moreimpl Copy for CellAnchorPoint
Source§impl Debug for CellAnchorPoint
impl Debug for CellAnchorPoint
Source§impl Default for CellAnchorPoint
impl Default for CellAnchorPoint
Source§fn default() -> CellAnchorPoint
fn default() -> CellAnchorPoint
Returns the “default value” for a type. Read more
impl Eq for CellAnchorPoint
Source§impl PartialEq for CellAnchorPoint
impl PartialEq for CellAnchorPoint
impl StructuralPartialEq for CellAnchorPoint
Auto Trait Implementations§
impl Freeze for CellAnchorPoint
impl RefUnwindSafe for CellAnchorPoint
impl Send for CellAnchorPoint
impl Sync for CellAnchorPoint
impl Unpin for CellAnchorPoint
impl UnsafeUnpin for CellAnchorPoint
impl UnwindSafe for CellAnchorPoint
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> 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.