FIX: Adds documentation

This commit is contained in:
Nicolás Hatcher
2024-02-18 20:37:39 +01:00
parent 7091c6372a
commit ed04ac6dfc
5 changed files with 88 additions and 33 deletions

View File

@@ -3,7 +3,7 @@
//! 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
//!
//! ## Usage
//! ## Basic usage
//!
//! Add the dependency in `Cargo.toml`:
//!
@@ -14,45 +14,27 @@
//!
//! <small> until version 0.5.0 you should use the git dependencies as stated </small>
//!
//! A simple example:
//! A simple example with some numbers, a new sheet and a formula:
//!
//!
//! ```rust
//! use ironcalc::{
//! base::{expressions::utils::number_to_column, model::Model},
//! export::save_to_xlsx,
//! };
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut model = Model::new_empty("hello-calc.xlsx", "en", "UTC")?;
//! // Adds a square of numbers in the first sheet
//! for row in 1..100 {
//! for column in 1..100 {
//! let value = row * column;
//! model.set_user_input(0, row, column, format!("{}", value));
//! }
//! }
//! // Adds a new sheet
//! model.add_sheet("Calculation")?;
//! // column 100 is CV
//! let last_column = number_to_column(100).unwrap();
//! let formula = format!("=SUM(Sheet1!A1:{}100)", last_column);
//! model.set_user_input(1, 1, 1, formula);
//!
//! // evaluates
//! model.evaluate();
//!
//! // saves to disk
//! save_to_xlsx(&model, "hello-calc.xlsx")?;
//! Ok(())
//! }
#![doc = include_str!("../examples/hello_calc.rs")]
//! ```
//!
//! You can then just:
//! ## Styling the workbook
//!
//! ```bash
//! cargo run
//! Adding colors, to cells, full columns or full rows is easy
//!
//! ```rust
#![doc = include_str!("../examples/hello_styles.rs")]
//! ```
//!
//! 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",