feat: Add doc grid type (#248)
* feat: Add doc grid type * feat: Add docgrid features * update snaps * 0.0.167 * add output * expose docGrid * fix: name * updatemain
parent
71812cb27d
commit
ae1f3ada58
|
@ -135,6 +135,11 @@ impl Document {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn doc_grid(mut self, doc_grid: DocGrid) -> Self {
|
||||||
|
self.section_property = self.section_property.doc_grid(doc_grid);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn default_section_property(mut self, property: SectionProperty) -> Self {
|
pub fn default_section_property(mut self, property: SectionProperty) -> Self {
|
||||||
self.section_property = property;
|
self.section_property = property;
|
||||||
self
|
self
|
||||||
|
@ -186,9 +191,7 @@ mod tests {
|
||||||
str::from_utf8(&b).unwrap(),
|
str::from_utf8(&b).unwrap(),
|
||||||
r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
r#"<?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" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" mc:Ignorable="w14 wp14">
|
<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" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" mc:Ignorable="w14 wp14">
|
||||||
<w:body><w:p w14:paraId="12345678"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p><w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:headerReference w:type="default" r:id="rId4" /><w:cols w:space="425" />
|
<w:body><w:p w14:paraId="12345678"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p><w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:headerReference w:type="default" r:id="rId4" /><w:cols w:space="425" /><w:docGrid w:type="lines" w:linePitch="360" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type="lines" w:linePitch="360" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"#
|
</w:document>"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::documents::BuildXML;
|
||||||
|
use crate::types::*;
|
||||||
|
use crate::xml_builder::*;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct DocGrid {
|
||||||
|
grid_type: DocGridType,
|
||||||
|
line_pitch: Option<usize>,
|
||||||
|
char_space: Option<usize>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DocGrid {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_empty() -> Self {
|
||||||
|
Self {
|
||||||
|
grid_type: DocGridType::Default,
|
||||||
|
line_pitch: None,
|
||||||
|
char_space: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn grid_type(mut self, t: DocGridType) -> Self {
|
||||||
|
self.grid_type = t;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn line_pitch(mut self, line_pitch: usize) -> Self {
|
||||||
|
self.line_pitch = Some(line_pitch);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn char_space(mut self, char_space: usize) -> Self {
|
||||||
|
self.char_space = Some(char_space);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for DocGrid {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
grid_type: DocGridType::Lines,
|
||||||
|
line_pitch: Some(360),
|
||||||
|
char_space: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BuildXML for DocGrid {
|
||||||
|
fn build(&self) -> Vec<u8> {
|
||||||
|
let b = XMLBuilder::new();
|
||||||
|
b.doc_grid(&self.grid_type, self.line_pitch, self.char_space)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ mod default_tab_stop;
|
||||||
mod delete;
|
mod delete;
|
||||||
mod delete_text;
|
mod delete_text;
|
||||||
mod doc_defaults;
|
mod doc_defaults;
|
||||||
|
mod doc_grid;
|
||||||
mod doc_id;
|
mod doc_id;
|
||||||
mod doc_var;
|
mod doc_var;
|
||||||
mod drawing;
|
mod drawing;
|
||||||
|
@ -104,6 +105,7 @@ pub use default_tab_stop::*;
|
||||||
pub use delete::*;
|
pub use delete::*;
|
||||||
pub use delete_text::*;
|
pub use delete_text::*;
|
||||||
pub use doc_defaults::*;
|
pub use doc_defaults::*;
|
||||||
|
pub use doc_grid::*;
|
||||||
pub use doc_id::*;
|
pub use doc_id::*;
|
||||||
pub use doc_var::*;
|
pub use doc_var::*;
|
||||||
pub use drawing::*;
|
pub use drawing::*;
|
||||||
|
|
|
@ -53,9 +53,7 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
str::from_utf8(&b).unwrap(),
|
str::from_utf8(&b).unwrap(),
|
||||||
r#"<w:p w14:paraId="12345678">
|
r#"<w:p w14:paraId="12345678">
|
||||||
<w:pPr><w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:headerReference w:type="default" r:id="rId4" /><w:cols w:space="425" />
|
<w:pPr><w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:headerReference w:type="default" r:id="rId4" /><w:cols w:space="425" /><w:docGrid w:type="lines" w:linePitch="360" /></w:sectPr></w:pPr>
|
||||||
<w:docGrid w:type="lines" w:linePitch="360" />
|
|
||||||
</w:sectPr></w:pPr>
|
|
||||||
</w:p>"#
|
</w:p>"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub struct SectionProperty {
|
||||||
page_size: PageSize,
|
page_size: PageSize,
|
||||||
page_margin: PageMargin,
|
page_margin: PageMargin,
|
||||||
columns: usize,
|
columns: usize,
|
||||||
document_grid: usize,
|
doc_grid: DocGrid,
|
||||||
header_reference: HeaderReference,
|
header_reference: HeaderReference,
|
||||||
section_type: Option<SectionType>,
|
section_type: Option<SectionType>,
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,11 @@ impl SectionProperty {
|
||||||
self.page_margin = margin;
|
self.page_margin = margin;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn doc_grid(mut self, doc_grid: DocGrid) -> Self {
|
||||||
|
self.doc_grid = doc_grid;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SectionProperty {
|
impl Default for SectionProperty {
|
||||||
|
@ -38,7 +43,7 @@ impl Default for SectionProperty {
|
||||||
page_size: PageSize::new(),
|
page_size: PageSize::new(),
|
||||||
page_margin: PageMargin::new(),
|
page_margin: PageMargin::new(),
|
||||||
columns: 425,
|
columns: 425,
|
||||||
document_grid: 360,
|
doc_grid: DocGrid::default(),
|
||||||
header_reference: HeaderReference::default(),
|
header_reference: HeaderReference::default(),
|
||||||
section_type: None,
|
section_type: None,
|
||||||
}
|
}
|
||||||
|
@ -54,7 +59,7 @@ impl BuildXML for SectionProperty {
|
||||||
.add_child(&self.page_margin)
|
.add_child(&self.page_margin)
|
||||||
.add_child(&self.header_reference)
|
.add_child(&self.header_reference)
|
||||||
.columns(&format!("{}", &self.columns))
|
.columns(&format!("{}", &self.columns))
|
||||||
.document_grid("lines", &format!("{}", &self.document_grid));
|
.add_child(&self.doc_grid);
|
||||||
|
|
||||||
if let Some(t) = self.section_type {
|
if let Some(t) = self.section_type {
|
||||||
b = b.type_tag(&t.to_string());
|
b = b.type_tag(&t.to_string());
|
||||||
|
@ -77,9 +82,7 @@ mod tests {
|
||||||
let b = c.build();
|
let b = c.build();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
str::from_utf8(&b).unwrap(),
|
str::from_utf8(&b).unwrap(),
|
||||||
r#"<w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:headerReference w:type="default" r:id="rId4" /><w:cols w:space="425" />
|
r#"<w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:headerReference w:type="default" r:id="rId4" /><w:cols w:space="425" /><w:docGrid w:type="lines" w:linePitch="360" /></w:sectPr>"#
|
||||||
<w:docGrid w:type="lines" w:linePitch="360" />
|
|
||||||
</w:sectPr>"#
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
use std::io::Read;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use crate::types::*;
|
||||||
|
use xml::attribute::OwnedAttribute;
|
||||||
|
use xml::reader::EventReader;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
impl ElementReader for DocGrid {
|
||||||
|
fn read<R: Read>(
|
||||||
|
_r: &mut EventReader<R>,
|
||||||
|
attrs: &[OwnedAttribute],
|
||||||
|
) -> Result<Self, ReaderError> {
|
||||||
|
let mut doc_grid = DocGrid::with_empty();
|
||||||
|
for a in attrs {
|
||||||
|
let local_name = &a.name.local_name;
|
||||||
|
if local_name == "type" {
|
||||||
|
let t = DocGridType::from_str(&a.value)?;
|
||||||
|
doc_grid = doc_grid.grid_type(t);
|
||||||
|
} else if local_name == "linePitch" {
|
||||||
|
let line_pitch = f32::from_str(&a.value)?;
|
||||||
|
doc_grid = doc_grid.line_pitch(line_pitch as usize);
|
||||||
|
} else if local_name == "charSpace" {
|
||||||
|
let char_space = f32::from_str(&a.value)?;
|
||||||
|
doc_grid = doc_grid.char_space(char_space as usize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(doc_grid)
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ mod numberings;
|
||||||
mod paragraph;
|
mod paragraph;
|
||||||
mod read_zip;
|
mod read_zip;
|
||||||
mod rels;
|
mod rels;
|
||||||
|
mod doc_grid;
|
||||||
mod run;
|
mod run;
|
||||||
mod run_property;
|
mod run_property;
|
||||||
mod section_property;
|
mod section_property;
|
||||||
|
|
|
@ -79,6 +79,11 @@ impl ElementReader for SectionProperty {
|
||||||
let size = read_page_size(&attributes)?;
|
let size = read_page_size(&attributes)?;
|
||||||
sp = sp.page_size(size);
|
sp = sp.page_size(size);
|
||||||
}
|
}
|
||||||
|
XMLElement::DocGrid => {
|
||||||
|
if let Ok(doc_grid) = DocGrid::read(r, &attributes) {
|
||||||
|
sp = sp.doc_grid(doc_grid);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ pub enum XMLElement {
|
||||||
DocId,
|
DocId,
|
||||||
DocVars,
|
DocVars,
|
||||||
DocVar,
|
DocVar,
|
||||||
|
DocGrid,
|
||||||
DocDefaults,
|
DocDefaults,
|
||||||
RunPropertyDefault,
|
RunPropertyDefault,
|
||||||
SectionProperty,
|
SectionProperty,
|
||||||
|
@ -285,6 +286,7 @@ impl FromStr for XMLElement {
|
||||||
"rFonts" => Ok(XMLElement::RunFonts),
|
"rFonts" => Ok(XMLElement::RunFonts),
|
||||||
"pgMar" => Ok(XMLElement::PageMargin),
|
"pgMar" => Ok(XMLElement::PageMargin),
|
||||||
"docDefaults" => Ok(XMLElement::DocDefaults),
|
"docDefaults" => Ok(XMLElement::DocDefaults),
|
||||||
|
"docGrid" => Ok(XMLElement::DocGrid),
|
||||||
"rPrDefault" => Ok(XMLElement::RunPropertyDefault),
|
"rPrDefault" => Ok(XMLElement::RunPropertyDefault),
|
||||||
_ => Ok(XMLElement::Unsupported),
|
_ => Ok(XMLElement::Unsupported),
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
|
use std::str::FromStr;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
|
use super::errors;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub enum DocGridType {
|
||||||
|
Default,
|
||||||
|
Lines,
|
||||||
|
LinesAndChars,
|
||||||
|
SnapToChars,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for DocGridType {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
match *self {
|
||||||
|
DocGridType::Default => write!(f, "default"),
|
||||||
|
DocGridType::Lines => write!(f, "lines"),
|
||||||
|
DocGridType::LinesAndChars => write!(f, "linesAndChars"),
|
||||||
|
DocGridType::SnapToChars => write!(f, "snapToChars"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for DocGridType {
|
||||||
|
type Err = errors::TypeError;
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"default" => Ok(DocGridType::Default),
|
||||||
|
"lines" => Ok(DocGridType::Lines),
|
||||||
|
"linesAndChars" => Ok(DocGridType::LinesAndChars),
|
||||||
|
"snapToChars" => Ok(DocGridType::SnapToChars),
|
||||||
|
_ => Err(errors::TypeError::Unknown),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ pub mod alignment_type;
|
||||||
pub mod border_position;
|
pub mod border_position;
|
||||||
pub mod border_type;
|
pub mod border_type;
|
||||||
pub mod break_type;
|
pub mod break_type;
|
||||||
|
pub mod doc_grid_type;
|
||||||
pub mod emu;
|
pub mod emu;
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
pub mod font_pitch_type;
|
pub mod font_pitch_type;
|
||||||
|
@ -23,6 +24,7 @@ pub use alignment_type::*;
|
||||||
pub use border_position::*;
|
pub use border_position::*;
|
||||||
pub use border_type::*;
|
pub use border_type::*;
|
||||||
pub use break_type::*;
|
pub use break_type::*;
|
||||||
|
pub use doc_grid_type::*;
|
||||||
pub use emu::*;
|
pub use emu::*;
|
||||||
pub use errors::*;
|
pub use errors::*;
|
||||||
pub use font_pitch_type::*;
|
pub use font_pitch_type::*;
|
||||||
|
|
|
@ -346,6 +346,28 @@ impl XMLBuilder {
|
||||||
.expect(EXPECT_MESSAGE);
|
.expect(EXPECT_MESSAGE);
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// docGrid
|
||||||
|
pub(crate) fn doc_grid(
|
||||||
|
mut self,
|
||||||
|
t: &DocGridType,
|
||||||
|
line_pitch: Option<usize>,
|
||||||
|
char_space: Option<usize>,
|
||||||
|
) -> Self {
|
||||||
|
let t = t.to_string();
|
||||||
|
let line_pitch_string = format!("{}", line_pitch.unwrap_or_default());
|
||||||
|
let char_space_string = format!("{}", char_space.unwrap_or_default());
|
||||||
|
let mut w = XmlEvent::start_element("w:docGrid").attr("w:type", &t);
|
||||||
|
if line_pitch.is_some() {
|
||||||
|
w = w.attr("w:linePitch", &line_pitch_string);
|
||||||
|
}
|
||||||
|
if char_space.is_some() {
|
||||||
|
w = w.attr("w:charSpace", &&char_space_string);
|
||||||
|
}
|
||||||
|
self.writer.write(w).expect(EXPECT_MESSAGE);
|
||||||
|
|
||||||
|
self.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,7 @@ import { Settings } from "./settings";
|
||||||
import { DocProps } from "./doc-props";
|
import { DocProps } from "./doc-props";
|
||||||
import { Styles } from "./styles";
|
import { Styles } from "./styles";
|
||||||
import { SectionProperty, PageMargin } from "./section-property";
|
import { SectionProperty, PageMargin } from "./section-property";
|
||||||
import { DocxJSON } from "./json";
|
import { DocGridType, DocxJSON } from "./json";
|
||||||
|
|
||||||
import * as wasm from "./pkg";
|
import * as wasm from "./pkg";
|
||||||
import { Level } from "./level";
|
import { Level } from "./level";
|
||||||
|
@ -127,6 +127,11 @@ export class Docx {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
docGrid(type: DocGridType, linePitch?: number, charSpace?: number) {
|
||||||
|
this.sectionProperty.docGrid(type, linePitch, charSpace);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
defaultSize(size: number) {
|
defaultSize(size: number) {
|
||||||
this.styles.defaultSize(size);
|
this.styles.defaultSize(size);
|
||||||
return this;
|
return this;
|
||||||
|
@ -718,6 +723,25 @@ export class Docx {
|
||||||
docx = docx.page_size(w, h);
|
docx = docx.page_size(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.sectionProperty._docGrid) {
|
||||||
|
const { gridType, charSpace, linePitch } = this.sectionProperty._docGrid;
|
||||||
|
let type = wasm.DocGridType.Default;
|
||||||
|
switch (gridType) {
|
||||||
|
case "lines":
|
||||||
|
type = wasm.DocGridType.Lines;
|
||||||
|
break;
|
||||||
|
case "linesAndChars":
|
||||||
|
type = wasm.DocGridType.LinesAndChars;
|
||||||
|
break;
|
||||||
|
case "snapToChars":
|
||||||
|
type = wasm.DocGridType.SnapToChars;
|
||||||
|
break;
|
||||||
|
case "default":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
docx = docx.doc_grid(type, linePitch, charSpace);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.styles?.docDefaults) {
|
if (this.styles?.docDefaults) {
|
||||||
if (this.styles.docDefaults.runProperty?.fonts) {
|
if (this.styles.docDefaults.runProperty?.fonts) {
|
||||||
const fonts = this.buildRunFonts(
|
const fonts = this.buildRunFonts(
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
export type DocGridType = "default" | "lines" | "linesAndChars" | "snapToChars";
|
||||||
|
|
||||||
|
export type DocGridJSON = {
|
||||||
|
gridType: DocGridType;
|
||||||
|
linePitch: number | null;
|
||||||
|
charSpace: number | null;
|
||||||
|
};
|
||||||
|
|
||||||
export type SectionPropertyJSON = {
|
export type SectionPropertyJSON = {
|
||||||
pageSize: {
|
pageSize: {
|
||||||
w: number;
|
w: number;
|
||||||
|
@ -13,5 +21,5 @@ export type SectionPropertyJSON = {
|
||||||
gutter: number;
|
gutter: number;
|
||||||
};
|
};
|
||||||
columns: number;
|
columns: number;
|
||||||
documentGrid: number;
|
docGrid: DocGridJSON;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
|
import { DocGridType } from ".";
|
||||||
|
|
||||||
|
export type DocGrid = {
|
||||||
|
gridType: DocGridType;
|
||||||
|
linePitch?: number;
|
||||||
|
charSpace?: number;
|
||||||
|
};
|
||||||
|
|
||||||
export class SectionProperty {
|
export class SectionProperty {
|
||||||
_pageSize: PageSize | null = null;
|
_pageSize: PageSize | null = null;
|
||||||
_pageMargin: PageMargin | null = null;
|
_pageMargin: PageMargin | null = null;
|
||||||
|
_docGrid: DocGrid = {
|
||||||
|
gridType: "lines",
|
||||||
|
linePitch: 360,
|
||||||
|
};
|
||||||
|
|
||||||
pageSize(w: number, h: number) {
|
pageSize(w: number, h: number) {
|
||||||
this._pageSize = { w, h };
|
this._pageSize = { w, h };
|
||||||
|
@ -11,6 +23,11 @@ export class SectionProperty {
|
||||||
this._pageMargin = { ...defaultPageMargin(), ...margin };
|
this._pageMargin = { ...defaultPageMargin(), ...margin };
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
docGrid(gridType: DocGridType, linePitch?: number, charSpace?: number) {
|
||||||
|
this._docGrid = { gridType, linePitch, charSpace };
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PageSize = { w: number; h: number };
|
export type PageSize = { w: number; h: number };
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docx-wasm",
|
"name": "docx-wasm",
|
||||||
"version": "0.0.166",
|
"version": "0.0.169",
|
||||||
"main": "dist/node/index.js",
|
"main": "dist/node/index.js",
|
||||||
"browser": "dist/web/index.js",
|
"browser": "dist/web/index.js",
|
||||||
"author": "bokuweb <bokuweb12@gmail.com>",
|
"author": "bokuweb <bokuweb12@gmail.com>",
|
||||||
|
|
|
@ -88,6 +88,23 @@ impl Docx {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn doc_grid(
|
||||||
|
mut self,
|
||||||
|
grid_type: docx_rs::DocGridType,
|
||||||
|
line_pitch: Option<usize>,
|
||||||
|
char_space: Option<usize>,
|
||||||
|
) -> Self {
|
||||||
|
let mut doc_grid = docx_rs::DocGrid::with_empty().grid_type(grid_type);
|
||||||
|
if let Some(line_pitch) = line_pitch {
|
||||||
|
doc_grid = doc_grid.line_pitch(line_pitch);
|
||||||
|
}
|
||||||
|
if let Some(char_space) = char_space {
|
||||||
|
doc_grid = doc_grid.char_space(char_space);
|
||||||
|
}
|
||||||
|
self.0.document = self.0.document.doc_grid(doc_grid);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(&mut self, has_numberings: bool) -> Result<Vec<u8>, JsValue> {
|
pub fn build(&mut self, has_numberings: bool) -> Result<Vec<u8>, JsValue> {
|
||||||
let buf = Vec::new();
|
let buf = Vec::new();
|
||||||
let mut cur = std::io::Cursor::new(buf);
|
let mut cur = std::io::Cursor::new(buf);
|
||||||
|
|
|
@ -606,7 +606,11 @@ Object {
|
||||||
"hasNumbering": false,
|
"hasNumbering": false,
|
||||||
"sectionProperty": Object {
|
"sectionProperty": Object {
|
||||||
"columns": 425,
|
"columns": 425,
|
||||||
"documentGrid": 360,
|
"docGrid": Object {
|
||||||
|
"charSpace": null,
|
||||||
|
"gridType": "lines",
|
||||||
|
"linePitch": 360,
|
||||||
|
},
|
||||||
"headerReference": Object {
|
"headerReference": Object {
|
||||||
"headerType": "default",
|
"headerType": "default",
|
||||||
"id": "rId4",
|
"id": "rId4",
|
||||||
|
@ -2795,7 +2799,11 @@ Object {
|
||||||
"hasNumbering": false,
|
"hasNumbering": false,
|
||||||
"sectionProperty": Object {
|
"sectionProperty": Object {
|
||||||
"columns": 425,
|
"columns": 425,
|
||||||
"documentGrid": 360,
|
"docGrid": Object {
|
||||||
|
"charSpace": null,
|
||||||
|
"gridType": "lines",
|
||||||
|
"linePitch": 360,
|
||||||
|
},
|
||||||
"headerReference": Object {
|
"headerReference": Object {
|
||||||
"headerType": "default",
|
"headerType": "default",
|
||||||
"id": "rId4",
|
"id": "rId4",
|
||||||
|
@ -3602,7 +3610,11 @@ Object {
|
||||||
"hasNumbering": true,
|
"hasNumbering": true,
|
||||||
"sectionProperty": Object {
|
"sectionProperty": Object {
|
||||||
"columns": 425,
|
"columns": 425,
|
||||||
"documentGrid": 360,
|
"docGrid": Object {
|
||||||
|
"charSpace": null,
|
||||||
|
"gridType": "lines",
|
||||||
|
"linePitch": 360,
|
||||||
|
},
|
||||||
"headerReference": Object {
|
"headerReference": Object {
|
||||||
"headerType": "default",
|
"headerType": "default",
|
||||||
"id": "rId4",
|
"id": "rId4",
|
||||||
|
@ -7155,7 +7167,11 @@ Object {
|
||||||
"hasNumbering": true,
|
"hasNumbering": true,
|
||||||
"sectionProperty": Object {
|
"sectionProperty": Object {
|
||||||
"columns": 425,
|
"columns": 425,
|
||||||
"documentGrid": 360,
|
"docGrid": Object {
|
||||||
|
"charSpace": null,
|
||||||
|
"gridType": "lines",
|
||||||
|
"linePitch": 360,
|
||||||
|
},
|
||||||
"headerReference": Object {
|
"headerReference": Object {
|
||||||
"headerType": "default",
|
"headerType": "default",
|
||||||
"id": "rId4",
|
"id": "rId4",
|
||||||
|
@ -9908,7 +9924,11 @@ Object {
|
||||||
"hasNumbering": false,
|
"hasNumbering": false,
|
||||||
"sectionProperty": Object {
|
"sectionProperty": Object {
|
||||||
"columns": 425,
|
"columns": 425,
|
||||||
"documentGrid": 360,
|
"docGrid": Object {
|
||||||
|
"charSpace": null,
|
||||||
|
"gridType": "lines",
|
||||||
|
"linePitch": 360,
|
||||||
|
},
|
||||||
"headerReference": Object {
|
"headerReference": Object {
|
||||||
"headerType": "default",
|
"headerType": "default",
|
||||||
"id": "rId4",
|
"id": "rId4",
|
||||||
|
@ -10494,9 +10514,7 @@ exports[`writer should write cell shading 2`] = `
|
||||||
<w:left w:w=\\"54\\" w:type=\\"dxa\\" />
|
<w:left w:w=\\"54\\" w:type=\\"dxa\\" />
|
||||||
<w:bottom w:w=\\"55\\" w:type=\\"dxa\\" />
|
<w:bottom w:w=\\"55\\" w:type=\\"dxa\\" />
|
||||||
<w:right w:w=\\"55\\" w:type=\\"dxa\\" />
|
<w:right w:w=\\"55\\" w:type=\\"dxa\\" />
|
||||||
</w:tblCellMar><w:tblInd w:w=\\"0\\" w:type=\\"dxa\\" /></w:tblPr><w:tblGrid /><w:tr><w:trPr /><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders><w:shd w:val=\\"clear\\" w:color=\\"auto\\" w:fill=\\"FF0000\\" /></w:tcPr><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
</w:tblCellMar><w:tblInd w:w=\\"0\\" w:type=\\"dxa\\" /></w:tblPr><w:tblGrid /><w:tr><w:trPr /><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders><w:shd w:val=\\"clear\\" w:color=\\"auto\\" w:fill=\\"FF0000\\" /></w:tcPr><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10521,9 +10539,7 @@ exports[`writer should write default font 1`] = `
|
||||||
exports[`writer should write default font 2`] = `
|
exports[`writer should write default font 2`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
<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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10534,6 +10550,31 @@ exports[`writer should write default font 3`] = `
|
||||||
</w:num></w:numbering>"
|
</w:num></w:numbering>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`writer should write doc grid 1`] = `
|
||||||
|
"<?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\\" />
|
||||||
|
<Relationship Id=\\"rId4\\" Type=\\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\\" Target=\\"header1.xml\\" />
|
||||||
|
<Relationship Id=\\"rId5\\" Type=\\"http://schemas.microsoft.com/office/2011/relationships/commentsExtended\\" Target=\\"commentsExtended.xml\\" />
|
||||||
|
</Relationships>"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`writer should write doc grid 2`] = `
|
||||||
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"default\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
|
</w:document>"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`writer should write doc grid 3`] = `
|
||||||
|
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
||||||
|
<w:numbering xmlns:r=\\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\\" xmlns:o=\\"urn:schemas-microsoft-com:office:office\\" xmlns:v=\\"urn:schemas-microsoft-com:vml\\" xmlns:w=\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\"><w:abstractNum w:abstractNumId=\\"1\\"><w:lvl w:ilvl=\\"0\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimal\\" /><w:lvlText w:val=\\"%1.\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"420\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"1\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimal\\" /><w:lvlText w:val=\\"(%2)\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"840\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"2\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimalEnclosedCircle\\" /><w:lvlText w:val=\\"%3\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"1260\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"3\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimal\\" /><w:lvlText w:val=\\"%4.\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"1680\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"4\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimal\\" /><w:lvlText w:val=\\"(%5)\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"2100\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"5\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimalEnclosedCircle\\" /><w:lvlText w:val=\\"%6\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"2520\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"6\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimal\\" /><w:lvlText w:val=\\"%7.\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"2940\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"7\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimal\\" /><w:lvlText w:val=\\"(%8)\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"3360\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl><w:lvl w:ilvl=\\"8\\"><w:start w:val=\\"1\\" /><w:numFmt w:val=\\"decimalEnclosedCircle\\" /><w:lvlText w:val=\\"%9\\" /><w:lvlJc w:val=\\"left\\" /><w:pPr><w:rPr /><w:ind w:left=\\"3780\\" w:right=\\"0\\" w:hanging=\\"420\\" /></w:pPr><w:rPr /></w:lvl></w:abstractNum><w:num w:numId=\\"1\\">
|
||||||
|
<w:abstractNumId w:val=\\"1\\" />
|
||||||
|
</w:num></w:numbering>"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`writer should write doc vars 1`] = `
|
exports[`writer should write doc vars 1`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
|
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
|
||||||
<Relationships xmlns=\\"http://schemas.openxmlformats.org/package/2006/relationships\\">
|
<Relationships xmlns=\\"http://schemas.openxmlformats.org/package/2006/relationships\\">
|
||||||
|
@ -10548,9 +10589,7 @@ exports[`writer should write doc vars 1`] = `
|
||||||
exports[`writer should write doc vars 2`] = `
|
exports[`writer should write doc vars 2`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
<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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10575,9 +10614,7 @@ exports[`writer should write hello 1`] = `
|
||||||
exports[`writer should write hello 2`] = `
|
exports[`writer should write hello 2`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
<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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10603,9 +10640,7 @@ exports[`writer should write lvlOverride with level 1`] = `
|
||||||
exports[`writer should write lvlOverride with level 2`] = `
|
exports[`writer should write lvlOverride with level 2`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
<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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /><w:numPr><w:numId w:val=\\"0\\" /><w:ilvl w:val=\\"0\\" /></w:numPr></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /><w:numPr><w:numId w:val=\\"0\\" /><w:ilvl w:val=\\"0\\" /></w:numPr></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10641,9 +10676,7 @@ exports[`writer should write nested table 2`] = `
|
||||||
<w:left w:w=\\"54\\" w:type=\\"dxa\\" />
|
<w:left w:w=\\"54\\" w:type=\\"dxa\\" />
|
||||||
<w:bottom w:w=\\"55\\" w:type=\\"dxa\\" />
|
<w:bottom w:w=\\"55\\" w:type=\\"dxa\\" />
|
||||||
<w:right w:w=\\"55\\" w:type=\\"dxa\\" />
|
<w:right w:w=\\"55\\" w:type=\\"dxa\\" />
|
||||||
</w:tblCellMar><w:tblInd w:w=\\"0\\" w:type=\\"dxa\\" /></w:tblPr><w:tblGrid /><w:tr><w:trPr /><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr></w:p></w:tc></w:tr></w:tbl><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
</w:tblCellMar><w:tblInd w:w=\\"0\\" w:type=\\"dxa\\" /></w:tblPr><w:tblGrid /><w:tr><w:trPr /><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr></w:p></w:tc></w:tr></w:tbl><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10668,9 +10701,7 @@ exports[`writer should write page margin 1`] = `
|
||||||
exports[`writer should write page margin 2`] = `
|
exports[`writer should write page margin 2`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
<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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1000\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"2000\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1000\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"2000\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10695,9 +10726,7 @@ exports[`writer should write page size 1`] = `
|
||||||
exports[`writer should write page size 2`] = `
|
exports[`writer should write page size 2`] = `
|
||||||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"yes\\"?>
|
"<?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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
<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\\" xmlns:w15=\\"http://schemas.microsoft.com/office/word/2012/wordml\\" mc:Ignorable=\\"w14 wp14\\">
|
||||||
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"400\\" w:h=\\"800\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
<w:body><w:p w14:paraId=\\"00000001\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello world!!</w:t></w:r></w:p><w:sectPr><w:pgSz w:w=\\"400\\" w:h=\\"800\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -10727,9 +10756,7 @@ exports[`writer should write tl2br and tr2bl cells 2`] = `
|
||||||
<w:left w:w=\\"54\\" w:type=\\"dxa\\" />
|
<w:left w:w=\\"54\\" w:type=\\"dxa\\" />
|
||||||
<w:bottom w:w=\\"55\\" w:type=\\"dxa\\" />
|
<w:bottom w:w=\\"55\\" w:type=\\"dxa\\" />
|
||||||
<w:right w:w=\\"55\\" w:type=\\"dxa\\" />
|
<w:right w:w=\\"55\\" w:type=\\"dxa\\" />
|
||||||
</w:tblCellMar><w:tblInd w:w=\\"0\\" w:type=\\"dxa\\" /></w:tblPr><w:tblGrid /><w:tr><w:trPr /><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tl2br w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000002\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tr2bl w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000003\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tl2br w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tr2bl w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000004\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" />
|
</w:tblCellMar><w:tblInd w:w=\\"0\\" w:type=\\"dxa\\" /></w:tblPr><w:tblGrid /><w:tr><w:trPr /><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tl2br w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000002\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tr2bl w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000003\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcBorders><w:top w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:left w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:bottom w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:right w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideH w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:insideV w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tl2br w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /><w:tr2bl w:val=\\"single\\" w:sz=\\"2\\" w:space=\\"0\\" w:color=\\"000000\\" /></w:tcBorders></w:tcPr><w:p w14:paraId=\\"00000004\\"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr><w:rFonts /></w:rPr><w:t xml:space=\\"preserve\\">Hello!!</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:sectPr><w:pgSz w:w=\\"11906\\" w:h=\\"16838\\" /><w:pgMar w:top=\\"1985\\" w:right=\\"1701\\" w:bottom=\\"1701\\" w:left=\\"1701\\" w:header=\\"851\\" w:footer=\\"992\\" w:gutter=\\"0\\" /><w:headerReference w:type=\\"default\\" r:id=\\"rId4\\" /><w:cols w:space=\\"425\\" /><w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" /></w:sectPr></w:body>
|
||||||
<w:docGrid w:type=\\"lines\\" w:linePitch=\\"360\\" />
|
|
||||||
</w:sectPr></w:body>
|
|
||||||
</w:document>"
|
</w:document>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
@ -196,4 +196,16 @@ describe("writer", () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("should write doc grid", () => {
|
||||||
|
const p = new w.Paragraph().addRun(new w.Run().addText("Hello world!!!!"));
|
||||||
|
const buffer = new w.Docx().addParagraph(p).docGrid("default", 360).build();
|
||||||
|
writeFileSync("../output/doc_grid.docx", buffer);
|
||||||
|
const z = new Zip(Buffer.from(buffer));
|
||||||
|
for (const e of z.getEntries()) {
|
||||||
|
if (e.entryName.match(/document.xml|numbering.xml/)) {
|
||||||
|
expect(z.readAsText(e)).toMatchSnapshot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue