Skip to content

hpcorona/xlsx-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xlsx-rs

A Excel file writer. Without themes, just data output.

Usage

extern crate xlsx;

use xlsx::workbook::Workbook;

let mut w = Workbook::new("tmp/doc1", "Rust");

w.initialize();

let number = w.new_format("#,###,###,##0.00");
let date = w.new_format("dd/mm/yyyy");

let mut s = w.new_worksheet("Sheet 1", 2);

s.cell_txt(w.value("Company Name"));
s.row();

s.cell_txt(w.value("Title 1"));
s.cell_txt(w.value("Title 2"));
s.cell_txt(w.value("Title 3"));
s.cell_txt(w.value("Title 4"));
s.row();

s.cell_num("50.00", number);
s.cell_num("1300.00", number);
s.cell_txt(w.value("20"));
s.cell_fmt(w.value("23/12/2015"), date);
s.flush();

s = w.new_worksheet("Sheet 2", 1);
s.cell_txt(w.value("Other Page"));
s.row();
s.cell_num("1", number);
s.row();
s.cell_fmt(w.value("12/02/1984"), date);
s.flush();

w.flush();

w.xlsx("tmp/doc1.xlsx");

Disclaimer

My first Rust program. Needs refactoring cause lifetimes nightmares at the start, but it's ok now.

About

Excel file Writer for Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages