UmyaSpreadsheet.PrintSettings (umya_spreadsheet_ex v0.7.0)
View SourceFunctions for configuring print settings in worksheets.
Summary
Functions
Gets the fit to page settings for a specific sheet.
Gets the footer text for a specific sheet.
Gets the header text for a specific sheet.
Gets the header and footer margins for a specific sheet.
Gets the page margins for a specific sheet.
Gets the page orientation for a specific sheet.
Gets the page scale for a specific sheet.
Gets the paper size for a specific sheet.
Gets the print area for a specific sheet.
Gets the print centered settings for a specific sheet.
Gets the print titles for a specific sheet.
Sets the fit-to-page options for a specific sheet.
Sets the footer text for a specific sheet.
Sets the header text for a specific sheet.
Sets the header and footer margins for a specific sheet.
Sets the page margins for a specific sheet.
Sets the page orientation for a specific sheet.
Sets the page scale percentage for a specific sheet.
Sets the paper size for a specific sheet.
Sets the print area for a specific sheet.
Sets whether to center the print horizontally and/or vertically.
Sets the rows and columns to repeat on each printed page (print titles).
Functions
Gets the fit to page settings for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, {fit_width, fit_height}} where fit_width and fit_height
are the number of pages to fit to, or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, {width, height}} = UmyaSpreadsheet.get_fit_to_page(spreadsheet, "Sheet1")
Gets the header text for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, header_text} where header_text is the header string,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, header} = UmyaSpreadsheet.get_header(spreadsheet, "Sheet1")
Gets the page margins for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, {top, right, bottom, left}} where each value is the margin in inches,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, {top, right, bottom, left}} = UmyaSpreadsheet.get_page_margins(spreadsheet, "Sheet1")
Gets the page orientation for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, orientation} where orientation is "portrait" or "landscape",
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, orientation} = UmyaSpreadsheet.get_page_orientation(spreadsheet, "Sheet1")
Gets the page scale for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, scale} where scale is the scaling percentage,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, scale} = UmyaSpreadsheet.get_page_scale(spreadsheet, "Sheet1")
Gets the paper size for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, paper_size} where paper_size is the paper size code,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, paper_size} = UmyaSpreadsheet.get_paper_size(spreadsheet, "Sheet1")
Gets the print area for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, print_area} where print_area is the range string,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, print_area} = UmyaSpreadsheet.get_print_area(spreadsheet, "Sheet1")
Gets the print centered settings for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, {horizontal, vertical}} where each value is a boolean
indicating whether the sheet is centered horizontally/vertically,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, {horizontal, vertical}} = UmyaSpreadsheet.get_print_centered(spreadsheet, "Sheet1")
Gets the print titles for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheet
Returns
Returns {:ok, {row_titles, column_titles}} where each value is a range string,
or {:error, reason} on failure.
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
{:ok, {rows, cols}} = UmyaSpreadsheet.get_print_titles(spreadsheet, "Sheet1")
Sets the fit-to-page options for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetwidth- The number of pages wide to fit the contentheight- The number of pages tall to fit the content
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_fit_to_page(spreadsheet, "Sheet1", 1, 2)
Sets the header text for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetheader- The header text, which can include special formatting codes
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_header(spreadsheet, "Sheet1", "&C&\"Arial,Bold\"Confidential")
Sets the page margins for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheettop- The top margin in inchesright- The right margin in inchesbottom- The bottom margin in inchesleft- The left margin in inches
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_page_margins(spreadsheet, "Sheet1", 1.0, 0.75, 1.0, 0.75)
Sets the page orientation for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetorientation- The orientation type: "portrait" or "landscape"
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_page_orientation(spreadsheet, "Sheet1", "landscape")
Sets the page scale percentage for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetscale- The scale percentage (e.g., 100 for 100%, 80 for 80%)
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_page_scale(spreadsheet, "Sheet1", 80)
Sets the paper size for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetpaper_size- The paper size code (e.g., 9 for A4)
Paper Size Codes
1 = Letter (8.5 x 11 in) 5 = Legal (8.5 x 14 in) 9 = A4 (210 x 297 mm) 8 = A3 (297 x 420 mm) 7 = A5 (148 x 210 mm)
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_paper_size(spreadsheet, "Sheet1", 9)
Sets the print area for a specific sheet.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetprint_area- The range to be printed (e.g., "A1:H20")
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_print_area(spreadsheet, "Sheet1", "A1:H20")
Sets whether to center the print horizontally and/or vertically.
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheethorizontal- Whether to center horizontallyvertical- Whether to center vertically
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_print_centered(spreadsheet, "Sheet1", true, false)
Sets the rows and columns to repeat on each printed page (print titles).
Parameters
spreadsheet- The spreadsheet structsheet_name- The name of the sheetrows- The rows to repeat (e.g., "1:2")columns- The columns to repeat (e.g., "A:B")
Examples
{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.set_print_titles(spreadsheet, "Sheet1", "1:2", "A:B")