2020-01-24 12:44:43 +02:00
|
|
|
use docx_rs::*;
|
|
|
|
|
2020-01-24 11:50:16 +02:00
|
|
|
pub fn main() -> Result<(), DocxError> {
|
|
|
|
let path = std::path::Path::new("./numbering.docx");
|
|
|
|
let file = std::fs::File::create(&path).unwrap();
|
|
|
|
Docx::new()
|
|
|
|
.add_paragraph(
|
|
|
|
Paragraph::new()
|
|
|
|
.add_run(Run::new().add_text("Hello"))
|
|
|
|
.numbering(NumberingId::new(2), IndentLevel::new(0)),
|
|
|
|
)
|
|
|
|
.add_numbering(
|
|
|
|
Numbering::new(2).add_level(
|
|
|
|
Level::new(
|
|
|
|
0,
|
|
|
|
Start::new(1),
|
|
|
|
NumberFormat::new("decimal"),
|
|
|
|
LevelText::new("Section %1."),
|
|
|
|
LevelJc::new("left"),
|
|
|
|
)
|
2020-02-11 10:01:39 +02:00
|
|
|
.indent(1620, Some(SpecialIndentType::Hanging(320)), None),
|
2020-01-24 11:50:16 +02:00
|
|
|
),
|
|
|
|
)
|
|
|
|
.build()
|
|
|
|
.pack(file)?;
|
|
|
|
Ok(())
|
|
|
|
}
|