feat: Add tab and break
parent
919f0af6af
commit
41432fb748
|
@ -1,16 +0,0 @@
|
|||
use docx_core::*;
|
||||
|
||||
pub fn main() -> Result<(), DocxError> {
|
||||
let path = std::path::Path::new("./output/alignment.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")))
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(" World"))
|
||||
.align(AlignmentType::Right),
|
||||
)
|
||||
.build()
|
||||
.pack(file)?;
|
||||
Ok(())
|
||||
}
|
|
@ -6,17 +6,21 @@ pub fn main() -> Result<(), DocxError> {
|
|||
let path = std::path::Path::new("./output/indent.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new(DUMMY)).indent(840, None))
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new().add_text(DUMMY))
|
||||
.indent(840, None),
|
||||
)
|
||||
.add_paragraph(Paragraph::new())
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(DUMMY))
|
||||
.add_run(Run::new().add_text(DUMMY))
|
||||
.indent(840, Some(SpecialIndentType::FirstLine(720))),
|
||||
)
|
||||
.add_paragraph(Paragraph::new())
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(DUMMY))
|
||||
.add_run(Run::new().add_text(DUMMY))
|
||||
.indent(1560, Some(SpecialIndentType::Hanging(720))),
|
||||
)
|
||||
.build()
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
use docx_core::*;
|
||||
|
||||
pub fn main() -> Result<(), DocxError> {
|
||||
let path = std::path::Path::new("./output/size.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")).size(60))
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(" Wor").size(50))
|
||||
.add_run(Run::new("ld")),
|
||||
)
|
||||
.build()
|
||||
.pack(file)?;
|
||||
Ok(())
|
||||
}
|
|
@ -4,11 +4,11 @@ use crate::xml_builder::*;
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct Document {
|
||||
children: Vec<DocumentContent>,
|
||||
children: Vec<DocumentChild>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DocumentContent {
|
||||
pub enum DocumentChild {
|
||||
Paragraph(Paragraph),
|
||||
Table(Table),
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ impl Document {
|
|||
}
|
||||
|
||||
pub fn add_paragraph(mut self, p: Paragraph) -> Self {
|
||||
self.children.push(DocumentContent::Paragraph(p));
|
||||
self.children.push(DocumentChild::Paragraph(p));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_table(mut self, t: Table) -> Self {
|
||||
self.children.push(DocumentContent::Table(t));
|
||||
self.children.push(DocumentChild::Table(t));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ impl BuildXML for Document {
|
|||
.open_body();
|
||||
for c in &self.children {
|
||||
match c {
|
||||
DocumentContent::Paragraph(p) => b = b.add_child(p),
|
||||
DocumentContent::Table(t) => b = b.add_child(t),
|
||||
DocumentChild::Paragraph(p) => b = b.add_child(p),
|
||||
DocumentChild::Table(t) => b = b.add_child(t),
|
||||
}
|
||||
}
|
||||
b.close().close().build()
|
||||
|
@ -65,7 +65,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_document() {
|
||||
let b = Document::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
|
||||
.build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
use crate::documents::BuildXML;
|
||||
use crate::types::*;
|
||||
use crate::xml_builder::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Break {
|
||||
break_type: BreakType,
|
||||
}
|
||||
|
||||
impl Break {
|
||||
pub fn new(t: BreakType) -> Break {
|
||||
Break { break_type: t }
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildXML for Break {
|
||||
fn build(&self) -> Vec<u8> {
|
||||
let b = XMLBuilder::new();
|
||||
b.br(&self.break_type.to_string()).build()
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
mod based_on;
|
||||
mod bold;
|
||||
mod bold_cs;
|
||||
mod br;
|
||||
mod color;
|
||||
mod doc_defaults;
|
||||
mod grid_span;
|
||||
|
@ -21,6 +22,7 @@ mod run_property_default;
|
|||
mod style;
|
||||
mod sz;
|
||||
mod sz_cs;
|
||||
mod tab;
|
||||
mod table;
|
||||
mod table_borders;
|
||||
mod table_cell;
|
||||
|
@ -40,6 +42,7 @@ mod vertical_merge;
|
|||
pub use based_on::*;
|
||||
pub use bold::*;
|
||||
pub use bold_cs::*;
|
||||
pub use br::*;
|
||||
pub use color::*;
|
||||
pub use doc_defaults::*;
|
||||
pub use grid_span::*;
|
||||
|
@ -60,6 +63,7 @@ pub use run_property_default::*;
|
|||
pub use style::*;
|
||||
pub use sz::*;
|
||||
pub use sz_cs::*;
|
||||
pub use tab::*;
|
||||
pub use table::*;
|
||||
pub use table_borders::*;
|
||||
pub use table_cell::*;
|
||||
|
|
|
@ -70,7 +70,9 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_paragraph() {
|
||||
let b = Paragraph::new().add_run(Run::new("Hello")).build();
|
||||
let b = Paragraph::new()
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
r#"<w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"#
|
||||
|
@ -79,7 +81,10 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_paragraph_size() {
|
||||
let b = Paragraph::new().add_run(Run::new("Hello")).size(60).build();
|
||||
let b = Paragraph::new()
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.size(60)
|
||||
.build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
r#"<w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:r><w:rPr><w:sz w:val="60" /><w:szCs w:val="60" /></w:rPr><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"#
|
||||
|
|
|
@ -1,21 +1,53 @@
|
|||
use super::{RunProperty, Text};
|
||||
use super::{Break, RunProperty, Tab, Text};
|
||||
use crate::documents::BuildXML;
|
||||
use crate::types::BreakType;
|
||||
use crate::xml_builder::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Run {
|
||||
run_property: RunProperty,
|
||||
text: Text,
|
||||
children: Vec<RunChild>,
|
||||
}
|
||||
|
||||
impl Default for Run {
|
||||
fn default() -> Self {
|
||||
let run_property = RunProperty::new();
|
||||
Self {
|
||||
run_property,
|
||||
children: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RunChild {
|
||||
Text(Text),
|
||||
Tab(Tab),
|
||||
Break(Break),
|
||||
}
|
||||
|
||||
impl Run {
|
||||
pub fn new(text: impl Into<String>) -> Run {
|
||||
pub fn new() -> Run {
|
||||
Run {
|
||||
text: Text::new(text),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_text(mut self, text: &str) -> Run {
|
||||
self.children.push(RunChild::Text(Text::new(text)));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_tab(mut self) -> Run {
|
||||
self.children.push(RunChild::Tab(Tab::new()));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_break(mut self, break_type: BreakType) -> Run {
|
||||
self.children.push(RunChild::Break(Break::new(break_type)));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn size(mut self, size: usize) -> Run {
|
||||
self.run_property = self.run_property.size(size);
|
||||
self
|
||||
|
@ -42,22 +74,18 @@ impl Run {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Run {
|
||||
fn default() -> Self {
|
||||
let run_property = RunProperty::new();
|
||||
let text = Text::new("");
|
||||
Self { run_property, text }
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildXML for Run {
|
||||
fn build(&self) -> Vec<u8> {
|
||||
let b = XMLBuilder::new();
|
||||
b.open_run()
|
||||
.add_child(&self.run_property)
|
||||
.add_child(&self.text)
|
||||
.close()
|
||||
.build()
|
||||
let mut b = b.open_run().add_child(&self.run_property);
|
||||
for c in &self.children {
|
||||
match c {
|
||||
RunChild::Text(t) => b = b.add_child(t),
|
||||
RunChild::Tab(t) => b = b.add_child(t),
|
||||
RunChild::Break(t) => b = b.add_child(t),
|
||||
}
|
||||
}
|
||||
b.close().build()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +99,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_build() {
|
||||
let b = Run::new("Hello").build();
|
||||
let b = Run::new().add_text("Hello").build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
r#"<w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r>"#
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
use crate::documents::BuildXML;
|
||||
use crate::xml_builder::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Tab {}
|
||||
|
||||
impl Tab {
|
||||
pub fn new() -> Tab {
|
||||
Tab {}
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildXML for Tab {
|
||||
fn build(&self) -> Vec<u8> {
|
||||
let b = XMLBuilder::new();
|
||||
b.tab().build()
|
||||
}
|
||||
}
|
|
@ -68,7 +68,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_cell_add_p() {
|
||||
let b = TableCell::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
|
||||
.build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
|
|
|
@ -12,8 +12,8 @@ pub fn simple() {
|
|||
let path = std::path::Path::new("./test.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new(" World")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new().add_text(" World")))
|
||||
.build()
|
||||
.pack(file);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Please see <xsd:simpleType name="ST_BrType">
|
||||
//
|
||||
|
||||
use std::fmt;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum BreakType {
|
||||
Page,
|
||||
Column,
|
||||
TextWrapping,
|
||||
}
|
||||
|
||||
impl fmt::Display for BreakType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
BreakType::Page => write!(f, "page"),
|
||||
BreakType::Column => write!(f, "column"),
|
||||
BreakType::TextWrapping => write!(f, "textWrapping"),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
pub mod alignment_type;
|
||||
pub mod border_position;
|
||||
pub mod border_type;
|
||||
pub mod break_type;
|
||||
pub mod special_indent_type;
|
||||
pub mod style_type;
|
||||
pub mod table_alignment_type;
|
||||
|
@ -10,6 +11,7 @@ pub mod width_type;
|
|||
pub use alignment_type::*;
|
||||
pub use border_position::*;
|
||||
pub use border_type::*;
|
||||
pub use break_type::*;
|
||||
pub use special_indent_type::*;
|
||||
pub use style_type::*;
|
||||
pub use table_alignment_type::*;
|
||||
|
|
|
@ -122,6 +122,9 @@ impl XMLBuilder {
|
|||
closed_border_el!(border_inside_v, "w:insideV");
|
||||
|
||||
closed_el!(shd, "w:shd", "w:fill", "w:val");
|
||||
|
||||
closed_el!(tab, "w:tab");
|
||||
closed_el!(br, "w:br", "w:type");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -9,17 +9,21 @@ pub fn indent() -> Result<(), DocxError> {
|
|||
let path = std::path::Path::new("./tests/output/indent.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new(DUMMY)).indent(840, None))
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new().add_text(DUMMY))
|
||||
.indent(840, None),
|
||||
)
|
||||
.add_paragraph(Paragraph::new())
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(DUMMY))
|
||||
.add_run(Run::new().add_text(DUMMY))
|
||||
.indent(840, Some(SpecialIndentType::FirstLine(720))),
|
||||
)
|
||||
.add_paragraph(Paragraph::new())
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(DUMMY))
|
||||
.add_run(Run::new().add_text(DUMMY))
|
||||
.indent(1560, Some(SpecialIndentType::Hanging(720))),
|
||||
)
|
||||
.build()
|
||||
|
@ -32,11 +36,15 @@ pub fn size() -> Result<(), DocxError> {
|
|||
let path = std::path::Path::new("./tests/output/size.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")).size(60))
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(" Wor").size(50))
|
||||
.add_run(Run::new("ld")),
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.size(60),
|
||||
)
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new().add_text(" Wor").size(50))
|
||||
.add_run(Run::new().add_text("ld")),
|
||||
)
|
||||
.build()
|
||||
.pack(file)?;
|
||||
|
@ -48,10 +56,10 @@ pub fn alignment() -> Result<(), DocxError> {
|
|||
let path = std::path::Path::new("./tests/output/alignment.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new(" World"))
|
||||
.add_run(Run::new().add_text(" World"))
|
||||
.align(AlignmentType::Right),
|
||||
)
|
||||
.build()
|
||||
|
@ -66,12 +74,12 @@ pub fn table() -> Result<(), DocxError> {
|
|||
|
||||
let table = Table::new(vec![
|
||||
TableRow::new(vec![
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("Hello"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("World"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("World"))),
|
||||
]),
|
||||
TableRow::new(vec![
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("Foo"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("Bar"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Foo"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Bar"))),
|
||||
]),
|
||||
]);
|
||||
Docx::new().add_table(table).build().pack(file)?;
|
||||
|
@ -85,12 +93,12 @@ pub fn table_with_grid() -> Result<(), DocxError> {
|
|||
|
||||
let table = Table::new(vec![
|
||||
TableRow::new(vec![
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("Hello"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("World"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("World"))),
|
||||
]),
|
||||
TableRow::new(vec![
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("Foo"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new("Bar"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Foo"))),
|
||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Bar"))),
|
||||
]),
|
||||
])
|
||||
.set_grid(vec![3000, 3000]);
|
||||
|
@ -109,7 +117,7 @@ pub fn table_merged() -> Result<(), DocxError> {
|
|||
.add_paragraph(Paragraph::new())
|
||||
.grid_span(2),
|
||||
TableCell::new()
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new("Hello")))
|
||||
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
|
||||
.vertical_merge(VMergeType::Restart),
|
||||
]),
|
||||
TableRow::new(vec![
|
||||
|
@ -143,23 +151,43 @@ pub fn decoration() -> Result<(), DocxError> {
|
|||
Docx::new()
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new("Hello"))
|
||||
.add_run(Run::new(" World").bold()),
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.add_run(Run::new().add_text(" World").bold()),
|
||||
)
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new("Hello"))
|
||||
.add_run(Run::new(" World").highlight("yellow")),
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.add_run(Run::new().add_text(" World").highlight("yellow")),
|
||||
)
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new("Hello"))
|
||||
.add_run(Run::new(" World").italic()),
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.add_run(Run::new().add_text(" World").italic()),
|
||||
)
|
||||
.add_paragraph(
|
||||
Paragraph::new()
|
||||
.add_run(Run::new("Hello"))
|
||||
.add_run(Run::new(" World").color("FF0000")),
|
||||
.add_run(Run::new().add_text("Hello"))
|
||||
.add_run(Run::new().add_text(" World").color("FF0000")),
|
||||
)
|
||||
.build()
|
||||
.pack(file)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn tab_and_break() -> Result<(), DocxError> {
|
||||
let path = std::path::Path::new("./tests/output/tab_and_break.docx");
|
||||
let file = std::fs::File::create(&path).unwrap();
|
||||
Docx::new()
|
||||
.add_paragraph(
|
||||
Paragraph::new().add_run(
|
||||
Run::new()
|
||||
.add_text("Hello")
|
||||
.add_tab()
|
||||
.add_text("World")
|
||||
.add_break(BreakType::Page)
|
||||
.add_text("Foo"),
|
||||
),
|
||||
)
|
||||
.build()
|
||||
.pack(file)?;
|
||||
|
|
|
@ -19,62 +19,10 @@
|
|||
<w:r>
|
||||
<w:rPr />
|
||||
<w:t xml:space="preserve">Hello</w:t>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:rPr>
|
||||
<w:b />
|
||||
<w:bCs />
|
||||
</w:rPr>
|
||||
<w:t xml:space="preserve"> World</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
<w:p>
|
||||
<w:pPr>
|
||||
<w:pStyle w:val="Normal" />
|
||||
<w:rPr />
|
||||
</w:pPr>
|
||||
<w:r>
|
||||
<w:rPr />
|
||||
<w:t xml:space="preserve">Hello</w:t>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:rPr>
|
||||
<w:highlight w:val="CCCCCC" />
|
||||
</w:rPr>
|
||||
<w:t xml:space="preserve"> World</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
<w:p>
|
||||
<w:pPr>
|
||||
<w:pStyle w:val="Normal" />
|
||||
<w:rPr />
|
||||
</w:pPr>
|
||||
<w:r>
|
||||
<w:rPr />
|
||||
<w:t xml:space="preserve">Hello</w:t>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:rPr>
|
||||
<w:i />
|
||||
<w:iCs />
|
||||
</w:rPr>
|
||||
<w:t xml:space="preserve"> World</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
<w:p>
|
||||
<w:pPr>
|
||||
<w:pStyle w:val="Normal" />
|
||||
<w:rPr />
|
||||
</w:pPr>
|
||||
<w:r>
|
||||
<w:rPr />
|
||||
<w:t xml:space="preserve">Hello</w:t>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:rPr>
|
||||
<w:color w:val="FF0000" />
|
||||
</w:rPr>
|
||||
<w:t xml:space="preserve"> World</w:t>
|
||||
<w:tab />
|
||||
<w:t xml:space="preserve">World</w:t>
|
||||
<w:br w:val="page" />
|
||||
<w:t xml:space="preserve">Foo</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:body>
|
||||
|
|
|
@ -14,9 +14,9 @@ pub fn createDocx() -> Docx {
|
|||
#[wasm_bindgen]
|
||||
impl Docx {
|
||||
pub fn add_paragraph(mut self) -> Self {
|
||||
self.0 = self
|
||||
.0
|
||||
.add_paragraph(docx_core::Paragraph::new().add_run(docx_core::Run::new("Hello")));
|
||||
self.0 = self.0.add_paragraph(
|
||||
docx_core::Paragraph::new().add_run(docx_core::Run::new().add_text("Hello")),
|
||||
);
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/word/_rels/document.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
||||
</Types>
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
||||
</Relationships>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Template></Template><TotalTime>0</TotalTime><Application>LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3</Application><Pages>2</Pages><Words>4</Words><Characters>21</Characters><CharactersWithSpaces>23</CharactersWithSpaces><Paragraphs>2</Paragraphs></Properties>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dcterms:created xsi:type="dcterms:W3CDTF">2019-11-13T16:09:41Z</dcterms:created><dc:creator></dc:creator><dc:description></dc:description><dc:language>ja-JP</dc:language><cp:lastModifiedBy></cp:lastModifiedBy><dcterms:modified xsi:type="dcterms:W3CDTF">2019-11-13T16:10:19Z</dcterms:modified><cp:revision>1</cp:revision><dc:subject></dc:subject><dc:title></dc:title></cp:coreProperties>
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
|
||||
</Relationships>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:document xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
||||
xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
||||
xmlns:w10="urn:schemas-microsoft-com:office:word"
|
||||
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
|
||||
xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
|
||||
xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"
|
||||
xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" mc:Ignorable="w14 wp14">
|
||||
<w:body>
|
||||
<w:p>
|
||||
<w:pPr>
|
||||
<w:pStyle w:val="Normal"/>
|
||||
<w:rPr></w:rPr>
|
||||
</w:pPr>
|
||||
<w:r>
|
||||
<w:rPr></w:rPr>
|
||||
<w:t>Start</w:t>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:br w:type="page"/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
<w:p>
|
||||
<w:pPr>
|
||||
<w:pStyle w:val="Normal"/>
|
||||
<w:rPr></w:rPr>
|
||||
</w:pPr>
|
||||
<w:r>
|
||||
<w:rPr></w:rPr>
|
||||
<w:t>Break</w:t>
|
||||
<w:tab/>
|
||||
<w:t>Tabaaa</w:t>
|
||||
<w:tab/>
|
||||
<w:t>aaaaa</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
<w:sectPr>
|
||||
<w:type w:val="nextPage"/>
|
||||
<w:pgSz w:w="11906" w:h="16838"/>
|
||||
<w:pgMar w:left="1134" w:right="1134" w:header="0" w:top="1134" w:footer="0" w:bottom="1134" w:gutter="0"/>
|
||||
<w:pgNumType w:fmt="decimal"/>
|
||||
<w:formProt w:val="false"/>
|
||||
<w:textDirection w:val="lrTb"/>
|
||||
</w:sectPr>
|
||||
</w:body>
|
||||
</w:document>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:fonts xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><w:font w:name="Times New Roman"><w:charset w:val="00"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Symbol"><w:charset w:val="02"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial"><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="Liberation Serif"><w:altName w:val="Times New Roman"/><w:charset w:val="01"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Liberation Sans"><w:altName w:val="Arial"/><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font></w:fonts>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:zoom w:percent="100"/><w:defaultTabStop w:val="709"/><w:compat><w:doNotExpandShiftReturn/></w:compat></w:settings>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="w14"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Liberation Serif" w:hAnsi="Liberation Serif" w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari"/><w:kern w:val="2"/><w:sz w:val="24"/><w:szCs w:val="24"/><w:lang w:val="en-US" w:eastAsia="ja-JP" w:bidi="hi-IN"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:widowControl/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/><w:pPr><w:widowControl/></w:pPr><w:rPr><w:rFonts w:ascii="Liberation Serif" w:hAnsi="Liberation Serif" w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari"/><w:color w:val="auto"/><w:kern w:val="2"/><w:sz w:val="24"/><w:szCs w:val="24"/><w:lang w:val="en-US" w:eastAsia="ja-JP" w:bidi="hi-IN"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style14"><w:name w:val="見出し"/><w:basedOn w:val="Normal"/><w:next w:val="Style15"/><w:qFormat/><w:pPr><w:keepNext w:val="true"/><w:spacing w:before="240" w:after="120"/></w:pPr><w:rPr><w:rFonts w:ascii="Liberation Sans" w:hAnsi="Liberation Sans" w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari"/><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style15"><w:name w:val="Body Text"/><w:basedOn w:val="Normal"/><w:pPr><w:spacing w:lineRule="auto" w:line="276" w:before="0" w:after="140"/></w:pPr><w:rPr></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style16"><w:name w:val="List"/><w:basedOn w:val="Style15"/><w:pPr></w:pPr><w:rPr><w:rFonts w:cs="Lohit Devanagari"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style17"><w:name w:val="Caption"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:suppressLineNumbers/><w:spacing w:before="120" w:after="120"/></w:pPr><w:rPr><w:rFonts w:cs="Lohit Devanagari"/><w:i/><w:iCs/><w:sz w:val="24"/><w:szCs w:val="24"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style18"><w:name w:val="索引"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:suppressLineNumbers/></w:pPr><w:rPr><w:rFonts w:cs="Lohit Devanagari"/></w:rPr></w:style></w:styles>
|
Loading…
Reference in New Issue