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("./alignment.docx");
|
2024-02-09 14:04:42 +02:00
|
|
|
let file = std::fs::File::create(path).unwrap();
|
2020-01-24 11:50:16 +02:00
|
|
|
Docx::new()
|
|
|
|
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
|
|
|
|
.add_paragraph(
|
|
|
|
Paragraph::new()
|
|
|
|
.add_run(Run::new().add_text(" World"))
|
|
|
|
.align(AlignmentType::Right),
|
|
|
|
)
|
|
|
|
.build()
|
|
|
|
.pack(file)?;
|
|
|
|
Ok(())
|
|
|
|
}
|