Support floating image (#75)
* feat: Support floating image * chore: update README * fix: lint errormain
parent
d3fcef1e2f
commit
69aedcb9d2
|
@ -80,6 +80,7 @@ writeFileSync("hello.docx", buf);
|
||||||
- [Numbering](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/numbering.rs)
|
- [Numbering](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/numbering.rs)
|
||||||
- [Table](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/table.rs)
|
- [Table](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/table.rs)
|
||||||
- [Comment](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/comment.rs)
|
- [Comment](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/comment.rs)
|
||||||
|
- [Image](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/image_inline.rs)
|
||||||
- [History](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/history.rs)
|
- [History](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/history.rs)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
@ -100,7 +101,7 @@ writeFileSync("hello.docx", buf);
|
||||||
- [ ] Header
|
- [ ] Header
|
||||||
- [ ] Footer
|
- [ ] Footer
|
||||||
- [x] Comment
|
- [x] Comment
|
||||||
- [ ] Image
|
- [x] Image
|
||||||
- [x] Style
|
- [x] Style
|
||||||
- [x] Table
|
- [x] Table
|
||||||
- [x] HIstory
|
- [x] HIstory
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
use std::fs::*;
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
use docx_rs::*;
|
||||||
|
|
||||||
|
pub fn main() -> Result<(), DocxError> {
|
||||||
|
let path = std::path::Path::new("./output/image.docx");
|
||||||
|
let file = File::create(&path).unwrap();
|
||||||
|
let mut img = File::open("./images/cat_min.jpg").unwrap();
|
||||||
|
let mut buf = Vec::new();
|
||||||
|
let _ = img.read_to_end(&mut buf).unwrap();
|
||||||
|
|
||||||
|
let pic = Pic::new(buf)
|
||||||
|
.size(320, 240)
|
||||||
|
.floating()
|
||||||
|
.offset_x(300)
|
||||||
|
.offset_y(400);
|
||||||
|
Docx::new()
|
||||||
|
.add_paragraph(Paragraph::new().add_run(Run::new().add_image(pic)))
|
||||||
|
.build()
|
||||||
|
.pack(file)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
|
@ -8,6 +8,8 @@ use crate::xml_builder::*;
|
||||||
#[derive(Debug, Clone, Serialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, PartialEq)]
|
||||||
pub struct Drawing {
|
pub struct Drawing {
|
||||||
pub position_type: DrawingPositionType,
|
pub position_type: DrawingPositionType,
|
||||||
|
pub position_h: DrawingPosition,
|
||||||
|
pub position_v: DrawingPosition,
|
||||||
pub data: Option<DrawingData>,
|
pub data: Option<DrawingData>,
|
||||||
// TODO: Old definition, remove later
|
// TODO: Old definition, remove later
|
||||||
pub children: Vec<DrawingChild>,
|
pub children: Vec<DrawingChild>,
|
||||||
|
@ -56,6 +58,7 @@ impl Drawing {
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove later
|
||||||
pub fn add_anchor(mut self, a: WpAnchor) -> Drawing {
|
pub fn add_anchor(mut self, a: WpAnchor) -> Drawing {
|
||||||
self.children.push(DrawingChild::WpAnchor(a));
|
self.children.push(DrawingChild::WpAnchor(a));
|
||||||
self
|
self
|
||||||
|
@ -65,6 +68,21 @@ impl Drawing {
|
||||||
self.data = Some(DrawingData::Pic(pic));
|
self.data = Some(DrawingData::Pic(pic));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn floating(mut self) -> Drawing {
|
||||||
|
self.position_type = DrawingPositionType::Anchor;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn position_h(mut self, pos: DrawingPosition) -> Drawing {
|
||||||
|
self.position_h = pos;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn position_v(mut self, pos: DrawingPosition) -> Drawing {
|
||||||
|
self.position_v = pos;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Drawing {
|
impl Default for Drawing {
|
||||||
|
@ -77,12 +95,14 @@ impl Default for Drawing {
|
||||||
dist_r: 0,
|
dist_r: 0,
|
||||||
},
|
},
|
||||||
data: None,
|
data: None,
|
||||||
|
position_v: DrawingPosition::Offset(0),
|
||||||
|
position_h: DrawingPosition::Offset(0),
|
||||||
children: vec![],
|
children: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BuildXML for Drawing {
|
impl BuildXML for Box<Drawing> {
|
||||||
fn build(&self) -> Vec<u8> {
|
fn build(&self) -> Vec<u8> {
|
||||||
let b = XMLBuilder::new();
|
let b = XMLBuilder::new();
|
||||||
let mut b = b.open_drawing();
|
let mut b = b.open_drawing();
|
||||||
|
@ -90,7 +110,21 @@ impl BuildXML for Drawing {
|
||||||
if let DrawingPositionType::Inline { .. } = self.position_type {
|
if let DrawingPositionType::Inline { .. } = self.position_type {
|
||||||
b = b.open_wp_inline("0", "0", "0", "0")
|
b = b.open_wp_inline("0", "0", "0", "0")
|
||||||
} else {
|
} else {
|
||||||
b = b.open_wp_anchor("0", "0", "0", "0");
|
b = b
|
||||||
|
.open_wp_anchor("0", "0", "0", "0", "0", "1", "0", "0", "1", "1905000")
|
||||||
|
.simple_pos("0", "0")
|
||||||
|
.open_position_h("page");
|
||||||
|
if let DrawingPosition::Offset(x) = self.position_h {
|
||||||
|
let x = format!("{}", crate::types::emu::from_px(x as u32));
|
||||||
|
b = b.pos_offset(&x).close();
|
||||||
|
}
|
||||||
|
|
||||||
|
b = b.open_position_v("page");
|
||||||
|
|
||||||
|
if let DrawingPosition::Offset(y) = self.position_v {
|
||||||
|
let y = format!("{}", crate::types::emu::from_px(y as u32));
|
||||||
|
b = b.pos_offset(&y).close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
match &self.data {
|
match &self.data {
|
||||||
Some(DrawingData::Pic(p)) => {
|
Some(DrawingData::Pic(p)) => {
|
||||||
|
@ -101,6 +135,7 @@ impl BuildXML for Drawing {
|
||||||
// One inch equates to 914400 EMUs and a centimeter is 360000
|
// One inch equates to 914400 EMUs and a centimeter is 360000
|
||||||
.wp_extent(&w, &h)
|
.wp_extent(&w, &h)
|
||||||
.wp_effect_extent("0", "0", "0", "0")
|
.wp_effect_extent("0", "0", "0", "0")
|
||||||
|
.wrap_none()
|
||||||
.wp_doc_pr("1", "Figure")
|
.wp_doc_pr("1", "Figure")
|
||||||
.open_wp_c_nv_graphic_frame_pr()
|
.open_wp_c_nv_graphic_frame_pr()
|
||||||
.a_graphic_frame_locks(
|
.a_graphic_frame_locks(
|
||||||
|
@ -135,13 +170,14 @@ mod tests {
|
||||||
let mut img = std::fs::File::open("../images/cat_min.jpg").unwrap();
|
let mut img = std::fs::File::open("../images/cat_min.jpg").unwrap();
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
let _ = img.read_to_end(&mut buf).unwrap();
|
let _ = img.read_to_end(&mut buf).unwrap();
|
||||||
let d = Drawing::new().pic(Pic::new(buf)).build();
|
let d = Box::new(Drawing::new().pic(Pic::new(buf))).build();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
str::from_utf8(&d).unwrap(),
|
str::from_utf8(&d).unwrap(),
|
||||||
r#"<w:drawing>
|
r#"<w:drawing>
|
||||||
<wp:inline distT="0" distB="0" distL="0" distR="0">
|
<wp:inline distT="0" distB="0" distL="0" distR="0">
|
||||||
<wp:extent cx="3048000" cy="2286000" />
|
<wp:extent cx="3048000" cy="2286000" />
|
||||||
<wp:effectExtent b="0" l="0" r="0" t="0" />
|
<wp:effectExtent b="0" l="0" r="0" t="0" />
|
||||||
|
<wp:wrapNone />
|
||||||
<wp:docPr id="1" name="Figure" />
|
<wp:docPr id="1" name="Figure" />
|
||||||
<wp:cNvGraphicFramePr>
|
<wp:cNvGraphicFramePr>
|
||||||
<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1" />
|
<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1" />
|
||||||
|
|
|
@ -1,15 +1,33 @@
|
||||||
|
use super::*;
|
||||||
use image::*;
|
use image::*;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::documents::*;
|
use crate::documents::*;
|
||||||
use crate::xml_builder::*;
|
use crate::xml_builder::*;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, Serialize, PartialEq)]
|
||||||
|
pub enum PicAlign {
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Bottom,
|
||||||
|
Top,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, Serialize, PartialEq)]
|
||||||
|
pub enum DrawingPosition {
|
||||||
|
Offset(usize),
|
||||||
|
Align(PicAlign),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, PartialEq)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Pic {
|
pub struct Pic {
|
||||||
pub id: usize,
|
pub id: usize,
|
||||||
pub image: Vec<u8>,
|
pub image: Vec<u8>,
|
||||||
pub size: (u32, u32),
|
pub size: (u32, u32),
|
||||||
|
pub position_type: DrawingPositionType,
|
||||||
|
pub position_h: DrawingPosition,
|
||||||
|
pub position_v: DrawingPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Pic {
|
impl Pic {
|
||||||
|
@ -21,13 +39,40 @@ impl Pic {
|
||||||
dimg
|
dimg
|
||||||
.write_to(&mut image, ImageFormat::Png)
|
.write_to(&mut image, ImageFormat::Png)
|
||||||
.expect("Unable to write");
|
.expect("Unable to write");
|
||||||
Self { id, image, size }
|
Self {
|
||||||
|
id,
|
||||||
|
image,
|
||||||
|
size,
|
||||||
|
position_type: DrawingPositionType::Inline {
|
||||||
|
dist_t: 0,
|
||||||
|
dist_b: 0,
|
||||||
|
dist_l: 0,
|
||||||
|
dist_r: 0,
|
||||||
|
},
|
||||||
|
position_h: DrawingPosition::Offset(0),
|
||||||
|
position_v: DrawingPosition::Offset(0),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn size(mut self, w_px: u32, h_px: u32) -> Pic {
|
pub fn size(mut self, w_px: u32, h_px: u32) -> Pic {
|
||||||
self.size = (w_px, h_px);
|
self.size = (w_px, h_px);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn floating(mut self) -> Pic {
|
||||||
|
self.position_type = DrawingPositionType::Anchor;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn offset_x(mut self, x: usize) -> Pic {
|
||||||
|
self.position_h = DrawingPosition::Offset(x);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn offset_y(mut self, y: usize) -> Pic {
|
||||||
|
self.position_v = DrawingPosition::Offset(y);
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BuildXML for Pic {
|
impl BuildXML for Pic {
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub enum RunChild {
|
||||||
DeleteText(DeleteText),
|
DeleteText(DeleteText),
|
||||||
Tab(Tab),
|
Tab(Tab),
|
||||||
Break(Break),
|
Break(Break),
|
||||||
Drawing(Drawing),
|
Drawing(Box<Drawing>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serialize for RunChild {
|
impl Serialize for RunChild {
|
||||||
|
@ -95,14 +95,26 @@ impl Run {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_image(mut self, pic: Pic) -> Run {
|
pub fn add_image(mut self, pic: Pic) -> Run {
|
||||||
self.children
|
if pic.position_type == DrawingPositionType::Anchor {
|
||||||
.push(RunChild::Drawing(Drawing::new().pic(pic)));
|
let pos_h = pic.position_h;
|
||||||
|
let pos_v = pic.position_v;
|
||||||
|
self.children.push(RunChild::Drawing(Box::new(
|
||||||
|
Drawing::new()
|
||||||
|
.pic(pic)
|
||||||
|
.floating()
|
||||||
|
.position_h(pos_h)
|
||||||
|
.position_v(pos_v),
|
||||||
|
)));
|
||||||
|
} else {
|
||||||
|
self.children
|
||||||
|
.push(RunChild::Drawing(Box::new(Drawing::new().pic(pic))));
|
||||||
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove later
|
// TODO: Remove later
|
||||||
pub fn add_drawing(mut self, d: Drawing) -> Run {
|
pub fn add_drawing(mut self, d: Drawing) -> Run {
|
||||||
self.children.push(RunChild::Drawing(d));
|
self.children.push(RunChild::Drawing(Box::new(d)));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,30 @@ use super::XMLBuilder;
|
||||||
use super::XmlEvent;
|
use super::XmlEvent;
|
||||||
|
|
||||||
impl XMLBuilder {
|
impl XMLBuilder {
|
||||||
open!(open_wp_inline, "wp:inline", "distT", "distB", "distL", "distR");
|
open!(
|
||||||
// TODO: Add some parameters
|
open_wp_inline,
|
||||||
open!(open_wp_anchor, "wp:inline", "distT", "distB", "distL", "distR");
|
"wp:inline",
|
||||||
|
"distT",
|
||||||
|
"distB",
|
||||||
|
"distL",
|
||||||
|
"distR"
|
||||||
|
);
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
open!(
|
||||||
|
open_wp_anchor,
|
||||||
|
"wp:anchor",
|
||||||
|
"distT",
|
||||||
|
"distB",
|
||||||
|
"distL",
|
||||||
|
"distR",
|
||||||
|
"simplePos",
|
||||||
|
"allowOverlap",
|
||||||
|
"behindDoc",
|
||||||
|
"locked",
|
||||||
|
"layoutInCell",
|
||||||
|
"relativeHeight"
|
||||||
|
);
|
||||||
|
|
||||||
open!(open_a_graphic, "a:graphic", "xmlns:a");
|
open!(open_a_graphic, "a:graphic", "xmlns:a");
|
||||||
open!(open_a_graphic_data, "a:graphicData", "uri");
|
open!(open_a_graphic_data, "a:graphicData", "uri");
|
||||||
|
@ -18,4 +39,10 @@ impl XMLBuilder {
|
||||||
"xmlns:a",
|
"xmlns:a",
|
||||||
"noChangeAspect"
|
"noChangeAspect"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
closed!(simple_pos, "wp:simplePos", "x", "y");
|
||||||
|
open!(open_position_h, "wp:positionH", "relativeFrom");
|
||||||
|
open!(open_position_v, "wp:positionV", "relativeFrom");
|
||||||
|
closed_with_child!(pos_offset, "wp:posOffset");
|
||||||
|
closed!(wrap_none, "wp:wrapNone");
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,11 @@ macro_rules! open {
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -27,7 +31,12 @@ macro_rules! open {
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -35,15 +44,210 @@ macro_rules! open {
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3).attr($attr4, arg4))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4),
|
||||||
|
)
|
||||||
|
.expect("should write to buf");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr) => {
|
||||||
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
) -> Self {
|
||||||
|
self.writer
|
||||||
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5),
|
||||||
|
)
|
||||||
|
.expect("should write to buf");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr) => {
|
||||||
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
) -> Self {
|
||||||
|
self.writer
|
||||||
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6),
|
||||||
|
)
|
||||||
|
.expect("should write to buf");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr) => {
|
||||||
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
arg7: &str,
|
||||||
|
) -> Self {
|
||||||
|
self.writer
|
||||||
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6)
|
||||||
|
.attr($attr7, arg7),
|
||||||
|
)
|
||||||
|
.expect("should write to buf");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr, $attr8: expr) => {
|
||||||
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
arg7: &str,
|
||||||
|
arg8: &str,
|
||||||
|
) -> Self {
|
||||||
|
self.writer
|
||||||
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6)
|
||||||
|
.attr($attr7, arg7)
|
||||||
|
.attr($attr8, arg8),
|
||||||
|
)
|
||||||
|
.expect("should write to buf");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr, $attr8: expr, $attr9: expr) => {
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
arg7: &str,
|
||||||
|
arg8: &str,
|
||||||
|
arg9: &str,
|
||||||
|
) -> Self {
|
||||||
|
self.writer
|
||||||
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6)
|
||||||
|
.attr($attr7, arg7)
|
||||||
|
.attr($attr8, arg8)
|
||||||
|
.attr($attr9, arg9),
|
||||||
|
)
|
||||||
|
.expect("should write to buf");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr, $attr8: expr, $attr9: expr, $attr10: expr) => {
|
||||||
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
arg7: &str,
|
||||||
|
arg8: &str,
|
||||||
|
arg9: &str,
|
||||||
|
arg10: &str,
|
||||||
|
) -> Self {
|
||||||
|
self.writer
|
||||||
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6)
|
||||||
|
.attr($attr7, arg7)
|
||||||
|
.attr($attr8, arg8)
|
||||||
|
.attr($attr9, arg9)
|
||||||
|
.attr($attr10, arg10),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -63,9 +267,7 @@ macro_rules! open_with_attrs {
|
||||||
val = &attr.1;
|
val = &attr.1;
|
||||||
e = e.attr(key, val);
|
e = e.attr(key, val);
|
||||||
}
|
}
|
||||||
self.writer
|
self.writer.write(e).expect("should write to buf");
|
||||||
.write(e)
|
|
||||||
.expect("should write to buf");
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -78,9 +280,7 @@ macro_rules! closed_with_child {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name))
|
.write(XmlEvent::start_element($el_name))
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.writer
|
self.writer.write(child).expect("should write to buf");
|
||||||
.write(child)
|
|
||||||
.expect("should write to buf");
|
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -89,31 +289,34 @@ macro_rules! closed_with_child {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0))
|
.write(XmlEvent::start_element($el_name).attr($attr0, arg0))
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.writer
|
self.writer.write(child).expect("should write to buf");
|
||||||
.write(child)
|
|
||||||
.expect("should write to buf");
|
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, child: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, child: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1))
|
.write(
|
||||||
.expect("should write to buf");
|
XmlEvent::start_element($el_name)
|
||||||
self.writer
|
.attr($attr0, arg0)
|
||||||
.write(child)
|
.attr($attr1, arg1),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
|
self.writer.write(child).expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, child: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, child: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2))
|
.write(
|
||||||
.expect("should write to buf");
|
XmlEvent::start_element($el_name)
|
||||||
self.writer
|
.attr($attr0, arg0)
|
||||||
.write(child)
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
|
self.writer.write(child).expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -140,7 +343,11 @@ macro_rules! closed {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
|
@ -148,7 +355,12 @@ macro_rules! closed {
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
|
@ -156,50 +368,146 @@ macro_rules! closed {
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str) -> Self {
|
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3).attr($attr4, arg4))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr) => {
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str, arg5: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3).attr($attr4, arg4).attr($attr5, arg5))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr) => {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str, arg5: &str, arg6: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3).attr($attr4, arg4).attr($attr5, arg5).attr($attr6, arg6))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr) => {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str, arg5: &str, arg6: &str, arg7: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
arg7: &str,
|
||||||
|
) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3).attr($attr4, arg4).attr($attr5, arg5).attr($attr6, arg6).attr($attr7, arg7))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6)
|
||||||
|
.attr($attr7, arg7),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr, $attr8: expr) => {
|
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr, $attr2: expr, $attr3: expr, $attr4: expr, $attr5: expr, $attr6: expr, $attr7: expr, $attr8: expr) => {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str, arg5: &str, arg6: &str, arg7: &str, arg8: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
|
mut self,
|
||||||
|
arg0: &str,
|
||||||
|
arg1: &str,
|
||||||
|
arg2: &str,
|
||||||
|
arg3: &str,
|
||||||
|
arg4: &str,
|
||||||
|
arg5: &str,
|
||||||
|
arg6: &str,
|
||||||
|
arg7: &str,
|
||||||
|
arg8: &str,
|
||||||
|
) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0).attr($attr1, arg1).attr($attr2, arg2).attr($attr3, arg3).attr($attr4, arg4).attr($attr5, arg5).attr($attr6, arg6).attr($attr7, arg7).attr($attr8, arg8))
|
.write(
|
||||||
|
XmlEvent::start_element($el_name)
|
||||||
|
.attr($attr0, arg0)
|
||||||
|
.attr($attr1, arg1)
|
||||||
|
.attr($attr2, arg2)
|
||||||
|
.attr($attr3, arg3)
|
||||||
|
.attr($attr4, arg4)
|
||||||
|
.attr($attr5, arg5)
|
||||||
|
.attr($attr6, arg6)
|
||||||
|
.attr($attr7, arg7)
|
||||||
|
.attr($attr8, arg8),
|
||||||
|
)
|
||||||
.expect("should write to buf");
|
.expect("should write to buf");
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
|
@ -232,31 +540,37 @@ macro_rules! closed_with_usize {
|
||||||
macro_rules! closed_w_with_type_el {
|
macro_rules! closed_w_with_type_el {
|
||||||
($name: ident, $el_name: expr) => {
|
($name: ident, $el_name: expr) => {
|
||||||
pub(crate) fn $name(mut self, w: i32, t: WidthType) -> Self {
|
pub(crate) fn $name(mut self, w: i32, t: WidthType) -> Self {
|
||||||
self.writer
|
self.writer
|
||||||
.write(
|
.write(
|
||||||
XmlEvent::start_element($el_name)
|
XmlEvent::start_element($el_name)
|
||||||
.attr("w:w", &format!("{}", w))
|
.attr("w:w", &format!("{}", w))
|
||||||
.attr("w:type", &t.to_string()),
|
.attr("w:type", &t.to_string()),
|
||||||
)
|
)
|
||||||
.expect(EXPECT_MESSAGE);
|
.expect(EXPECT_MESSAGE);
|
||||||
self.close()
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! closed_border_el {
|
macro_rules! closed_border_el {
|
||||||
($name: ident, $el_name: expr) => {
|
($name: ident, $el_name: expr) => {
|
||||||
pub(crate) fn $name(mut self, val: BorderType, size: usize, space: usize, color: &str) -> Self {
|
pub(crate) fn $name(
|
||||||
self.writer
|
mut self,
|
||||||
.write(
|
val: BorderType,
|
||||||
XmlEvent::start_element($el_name)
|
size: usize,
|
||||||
.attr("w:val", &val.to_string())
|
space: usize,
|
||||||
.attr("w:sz", &format!("{}", size))
|
color: &str,
|
||||||
.attr("w:space", &format!("{}", space))
|
) -> Self {
|
||||||
.attr("w:color", color),
|
self.writer
|
||||||
)
|
.write(
|
||||||
.expect(EXPECT_MESSAGE);
|
XmlEvent::start_element($el_name)
|
||||||
self.close()
|
.attr("w:val", &val.to_string())
|
||||||
|
.attr("w:sz", &format!("{}", size))
|
||||||
|
.attr("w:space", &format!("{}", space))
|
||||||
|
.attr("w:color", color),
|
||||||
|
)
|
||||||
|
.expect(EXPECT_MESSAGE);
|
||||||
|
self.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -21,7 +21,7 @@
|
||||||
<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" allowOverlap="1" behindDoc="0" locked="0" layoutInCell="1" relativeHeight="1905000">
|
<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" allowOverlap="1" behindDoc="0" locked="0" layoutInCell="1" relativeHeight="1905000">
|
||||||
<wp:simplePos x="0" y="0"/>
|
<wp:simplePos x="0" y="0"/>
|
||||||
<wp:positionH relativeFrom="page">
|
<wp:positionH relativeFrom="page">
|
||||||
<wp:align>right</wp:align>
|
<wp:posOffset>2014400</wp:posOffset>
|
||||||
</wp:positionH>
|
</wp:positionH>
|
||||||
<wp:positionV relativeFrom="page">
|
<wp:positionV relativeFrom="page">
|
||||||
<wp:align>bottom</wp:align>
|
<wp:align>bottom</wp:align>
|
||||||
|
|
Loading…
Reference in New Issue