UPDATE: Adds a bunch of documentation and examples
This commit is contained in:
@@ -4,18 +4,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut model = Model::new_empty("hello_styles", "en", "UTC")?;
|
||||
|
||||
// We are going to change styles in cell A1
|
||||
let sheet = 0;
|
||||
let row = 1;
|
||||
let column = 1;
|
||||
let (sheet, row, column) = (0, 1, 1);
|
||||
let mut style = model.get_style_for_cell(sheet, row, column);
|
||||
style.fill.fg_color = Some("#FFEE11".to_string());
|
||||
style.fill.fg_color = Some("#FF9011".to_string());
|
||||
style.font.b = true;
|
||||
style.font.color = Some("#EEFF22".to_string());
|
||||
style.font.color = Some("#E91E63".to_string());
|
||||
model.set_cell_style(sheet, row, column, &style)?;
|
||||
|
||||
// evaluates (unnecessary in this case)
|
||||
model.evaluate();
|
||||
|
||||
// saves to disk
|
||||
save_to_xlsx(&model, "hello-styles.xlsx")?;
|
||||
Ok(())
|
||||
|
||||
@@ -3,10 +3,9 @@ use ironcalc::{base::model::Model, export::save_to_xlsx};
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut model = Model::new_empty("widths-and-heights", "en", "UTC")?;
|
||||
// Cell C5
|
||||
let column = 3;
|
||||
let row = 5;
|
||||
let (sheet, row, column) = (0, 5, 3);
|
||||
// Make the first column 4 times as width
|
||||
let worksheet = model.workbook.worksheet_mut(0)?;
|
||||
let worksheet = model.workbook.worksheet_mut(sheet)?;
|
||||
let column_width = worksheet.column_width(column)? * 4.0;
|
||||
worksheet.set_column_width(column, column_width)?;
|
||||
|
||||
@@ -14,9 +13,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let row_height = worksheet.row_height(row)? * 2.0;
|
||||
worksheet.set_row_height(row, row_height)?;
|
||||
|
||||
// evaluates
|
||||
model.evaluate();
|
||||
|
||||
// saves to disk
|
||||
save_to_xlsx(&model, "widths-and-heights.xlsx")?;
|
||||
Ok(())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! # IronCalc - Core API documentation
|
||||
//!
|
||||
//! This technical API documentation in aimed at developers who want to develop bindings for a different language,
|
||||
//! build a UI based on the engine or just use the library in a Rust program
|
||||
//! This technical API documentation is aimed at developers.
|
||||
//! It is used to build language bindings (like python, javascript or nodejs) or to build full fledged applications like ironCalc in the terminal or IronCalc, the Web application.
|
||||
//!
|
||||
//! ## Basic usage
|
||||
//!
|
||||
@@ -21,7 +21,12 @@
|
||||
#![doc = include_str!("../examples/hello_calc.rs")]
|
||||
//! ```
|
||||
//!
|
||||
//! ## Styling the workbook
|
||||
//! ## Examples
|
||||
//!
|
||||
//! This is a collection of full fledged examples you can use as a starting point or for learning purposes.
|
||||
//! You might find the code in the examples folder
|
||||
//!
|
||||
//! ### Styling the workbook
|
||||
//!
|
||||
//! Adding colors, to cells, full columns or full rows is easy
|
||||
//!
|
||||
@@ -29,12 +34,11 @@
|
||||
#![doc = include_str!("../examples/hello_styles.rs")]
|
||||
//! ```
|
||||
//!
|
||||
//! Changing column width and row heigh
|
||||
//! ### Changing column width and row heigh
|
||||
//!
|
||||
//! ```rust
|
||||
#![doc = include_str!("../examples/widths_and_heights.rs")]
|
||||
//! ```
|
||||
//!
|
||||
|
||||
#![doc(
|
||||
html_logo_url = "https://raw.githubusercontent.com/ironcalc/ironcalc/main/assets/logo.png",
|
||||
|
||||
Reference in New Issue
Block a user