Skip to main content

PageGrid

Struct PageGrid 

Source
pub struct PageGrid {
Show 15 fields pub page_w: f64, pub page_h: f64, pub margins: [f64; 6], pub gap: f64, pub scale: f32, pub hf_sides: [f64; 2], pub hf_text_k: f32, pub paper_pt: (f32, f32), pub row_bands: Vec<(u32, u32)>, pub col_bands: Vec<(u32, u32)>, pub rows_complete: bool, pub cols_complete: bool, pub data_rows: (usize, usize), pub data_cols: (usize, usize), pub page_order: PageOrder, /* private fields */
}
Expand description

One sheet paginated for the Page Layout view.

Fields§

§page_w: f64

Page size in layout units.

§page_h: f64§margins: [f64; 6]

Left, right, top, bottom, header and footer margins in layout units.

§gap: f64

Gap between pages in layout units.

§scale: f32

Print scale (1.0 = 100%): screen sizes of cells are zoom × scale.

§hf_sides: [f64; 2]

Left and right margins of headers and footers in layout units (the side margins, or a fixed 0.7 inch, at most a quarter of the page width, with Align with Page Margins off).

§hf_text_k: f32

Layout units per sheet pixel of header and footer text: 1 with Scale with Document on, otherwise 1 / scale, so the text keeps its point size on paper.

§paper_pt: (f32, f32)

Paper size in points (after orientation), for the rulers.

§row_bands: Vec<(u32, u32)>§col_bands: Vec<(u32, u32)>§rows_complete: bool

The bands reach the sheet’s last row / column.

§cols_complete: bool§data_rows: (usize, usize)

Bands holding printed data: [first, last] row bands and column bands.

§data_cols: (usize, usize)§page_order: PageOrder

The sheet’s page order, which numbers the printed pages.

Implementations§

Source§

impl PageGrid

Source

pub fn build( wb: &Workbook, si: usize, need_row: u32, need_col: u32, ) -> Option<PageGrid>

Paginates sheet si far enough to cover row need_row and column need_col (and at least the printed area). None when the sheet doesn’t exist.

Source

pub fn covers(&self, r: u32, c: u32) -> bool

The grid covers row r and column c (else it needs a rebuild with more pages).

Source

pub fn page_x(&self, j: usize) -> f64

Left edge of page column j / top edge of page row i.

Source

pub fn page_y(&self, i: usize) -> f64

Source

pub fn page_rect(&self, i: usize, j: usize) -> (f64, f64, f64, f64)

The page rectangle (x, y, w, h) of page (i, j).

Source

pub fn content_rect(&self, i: usize, j: usize) -> (f64, f64, f64, f64)

Where the cells of page (i, j) go: inside the margins.

Source

pub fn col_x(&self, col: u32) -> f64

Left edge of column col.

Source

pub fn row_y(&self, row: u32) -> f64

Top edge of row row.

Source

pub fn page_col_at(&self, x: f64) -> usize

Page column under x (the nearest one in gaps).

Source

pub fn page_row_at(&self, y: f64) -> usize

Source

pub fn col_at(&self, x: f64) -> u32

Column under x, clamped to the page’s columns (margins and gaps hit the nearest one).

Source

pub fn row_at(&self, y: f64) -> u32

Source

pub fn page_at(&self, x: f64, y: f64) -> Option<(usize, usize)>

The page (i, j) whose paper contains the point, if any.

Source

pub fn on_cells(&self, x: f64, y: f64) -> bool

The point lies on cells (inside a page’s margins, on a cell of that page).

Source

pub fn hf_zone_at(&self, x: f64, y: f64) -> Option<((usize, usize), HfZone)>

The header or footer section under the point: the top or bottom margin of a page, split into thirds between the header and footer side margins.

Source

pub fn is_data_page(&self, i: usize, j: usize) -> bool

Page (i, j) holds printed data (others are “Click to add data” pages).

Source

pub fn page_number(&self, i: usize, j: usize) -> Option<(usize, usize)>

Printed page number of page (i, j) (in the sheet’s page order) and the printed page count.

Source

pub fn pages_in( &self, x0: f64, y0: f64, x1: f64, y1: f64, ) -> ((usize, usize), (usize, usize))

Page rows and columns overlapping the layout rectangle [x0, x1] × [y0, y1].

Source

pub fn extent(&self) -> (f64, f64)

Width / height of everything laid out so far.

Source

pub fn row_band(&self, i: usize) -> Option<(u32, u32)>

Rows (first, last) of a page row and columns of a page column.

Source

pub fn col_band(&self, j: usize) -> Option<(u32, u32)>

Trait Implementations§

Source§

impl Clone for PageGrid

Source§

fn clone(&self) -> PageGrid

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PageGrid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.