FIX: Adds minimal example and logo!
This commit is contained in:
BIN
assets/favicon.ico
Normal file
BIN
assets/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/first-logo.png
Normal file
BIN
assets/first-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -1,58 +1,64 @@
|
|||||||
//! This crate reads an xlsx file and transforms it into an internal representation ([`Model`]).
|
//! # IronCalc - Core API documentation
|
||||||
//! An `xlsx` is a zip file containing a set of folders and `xml` files. The IronCalc json structure mimics the relevant parts of the Excel zip.
|
|
||||||
//! Although the xlsx structure is quite complicated, it's essentials regarding the spreadsheet technology are easier to grasp.
|
|
||||||
//!
|
//!
|
||||||
//! The simplest workbook folder structure might look like this:
|
//! 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
|
||||||
//!
|
//!
|
||||||
//! ```text
|
//! ## Usage
|
||||||
//! docProps
|
|
||||||
//! app.xml
|
|
||||||
//! core.xml
|
|
||||||
//!
|
//!
|
||||||
//! _rels
|
//! Add the dependency in `Cargo.toml`:
|
||||||
//! .rels
|
|
||||||
//!
|
//!
|
||||||
//! xl
|
//! ```toml
|
||||||
//! _rels
|
//! [dependencies]
|
||||||
//! workbook.xml.rels
|
//! ironcalc = { git = "https://github.com/ironcalc/IronCalc", version = "0.1.0"}
|
||||||
//! theme
|
|
||||||
//! theme1.xml
|
|
||||||
//! worksheets
|
|
||||||
//! sheet1.xml
|
|
||||||
//! calcChain.xml
|
|
||||||
//! styles.xml
|
|
||||||
//! workbook.xml
|
|
||||||
//! sharedStrings.xml
|
|
||||||
//!
|
|
||||||
//! [Content_Types].xml
|
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Note that more complicated workbooks will have many more files and folders.
|
//! <small> until version 0.5.0 you should use the git dependencies as stated </small>
|
||||||
//! For instance charts, pivot tables, comments, tables,...
|
|
||||||
//!
|
//!
|
||||||
//! The relevant json structure in IronCalc will be:
|
//! A simple example:
|
||||||
//!
|
//!
|
||||||
//! ```json
|
//!
|
||||||
//! {
|
//! ```rust
|
||||||
//! "name": "Workbook1",
|
//! use ironcalc::{
|
||||||
//! "defined_names": [],
|
//! base::{expressions::utils::number_to_column, model::Model},
|
||||||
//! "shared_strings": [],
|
//! export::save_to_xlsx,
|
||||||
//! "worksheets": [],
|
//! };
|
||||||
//! "styles": {
|
//!
|
||||||
//! "num_fmts": [],
|
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
//! "fonts": [],
|
//! let mut model = Model::new_empty("hello-calc.xlsx", "en", "UTC")?;
|
||||||
//! "fills": [],
|
//! // Adds a square of numbers in the first sheet
|
||||||
//! "borders": [],
|
//! for row in 1..100 {
|
||||||
//! "cell_style_xfs": [],
|
//! for column in 1..100 {
|
||||||
//! "cell_styles" : [],
|
//! let value = row * column;
|
||||||
//! "cell_xfs": []
|
//! 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(())
|
||||||
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Note that there is not a 1-1 correspondence but there is a close resemblance.
|
//! You can then just:
|
||||||
//!
|
//!
|
||||||
//! [`Model`]: ../ironcalc/struct.Model.html
|
//! ```bash
|
||||||
|
//! cargo run
|
||||||
|
//! ```
|
||||||
|
|
||||||
|
|
||||||
|
#![doc(
|
||||||
|
html_logo_url = "https://raw.githubusercontent.com/ironcalc/ironcalc/main/assets/logo.png",
|
||||||
|
html_favicon_url = "https://raw.githubusercontent.com/ironcalc/ironcalc/main/assets/favicon.ico"
|
||||||
|
)]
|
||||||
|
|
||||||
pub mod compare;
|
pub mod compare;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
|||||||
Reference in New Issue
Block a user