-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathnumbering.rs
33 lines (32 loc) · 1010 Bytes
/
numbering.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use docx_rs::*;
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_abstract_numbering(
AbstractNumbering::new(2).add_level(
Level::new(
0,
Start::new(1),
NumberFormat::new("decimal"),
LevelText::new("Section %1."),
LevelJc::new("left"),
)
.indent(
Some(1620),
Some(SpecialIndentType::Hanging(320)),
None,
None,
),
),
)
.add_numbering(Numbering::new(2, 2))
.build()
.pack(file)?;
Ok(())
}