#excel #xml #writer #escaping #attributes #xml-format #xmlwriter

excel_xmlwriter

A simple Rust xml writer for Excel xml

1 unstable release

0.1.0 Jun 9, 2022

#35 in #xml-format

MIT license

17KB
321 lines

excel_xmlwriter is library for writing XML in the same format and with the same escaping as used by Excel in xlsx xml files.

This is a test crate for a future application and isn't currently very useful on its own.

use std::fs::File;
use excel_xmlwriter::XMLWriter;

fn main() -> Result<(), std::io::Error> {
    let xmlfile = File::create("test.xml")?;
    let mut writer = XMLWriter::new(&xmlfile);

    writer.xml_declaration();

    let attributes = vec![("bar", "1")];
    writer.xml_data_element("foo", "some text", &attributes);

    Ok(())
}

Output in test.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<foo bar="1">some text</foo>

lib.rs:

Excel_XMLWriter

excel_xmlwriter is library for writing XML in the same format and with the same escaping as used by Excel in xlsx xml files.

This is a test crate for a future application and isn't currently very useful on its own.

use std::fs::File;
use excel_xmlwriter::XMLWriter;

fn main() -> Result<(), std::io::Error> {
    let xmlfile = File::create("test.xml")?;
    let mut writer = XMLWriter::new(&xmlfile);

    writer.xml_declaration();

    let attributes = vec![("bar", "1")];
    writer.xml_data_element("foo", "some text", &attributes);

    Ok(())
}

Output in test.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<foo bar="1">some text</foo>

No runtime deps