openxml-docx 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/examples/drawing-ml +134 -0
- data/examples/table +28 -0
- data/lib/openxml/docx.rb +9 -0
- data/lib/openxml/docx/attribute_builder.rb +17 -4
- data/lib/openxml/docx/elements/absolute_position_tab.rb +4 -19
- data/lib/openxml/docx/elements/bidi_embed.rb +1 -10
- data/lib/openxml/docx/elements/bidi_override.rb +1 -9
- data/lib/openxml/docx/elements/break.rb +3 -14
- data/lib/openxml/docx/elements/control.rb +5 -2
- data/lib/openxml/docx/elements/deleted_text.rb +1 -1
- data/lib/openxml/docx/elements/drawing.rb +9 -0
- data/lib/openxml/docx/elements/element.rb +2 -1
- data/lib/openxml/docx/elements/embed_bold.rb +25 -0
- data/lib/openxml/docx/elements/embed_bold_italic.rb +25 -0
- data/lib/openxml/docx/elements/embed_italic.rb +25 -0
- data/lib/openxml/docx/elements/embed_regular.rb +25 -0
- data/lib/openxml/docx/elements/family.rb +22 -0
- data/lib/openxml/docx/elements/font.rb +14 -0
- data/lib/openxml/docx/elements/grid_column.rb +2 -2
- data/lib/openxml/docx/elements/group_shape.rb +10 -0
- data/lib/openxml/docx/elements/markup_compatibility_alternate_content.rb +10 -0
- data/lib/openxml/docx/elements/markup_compatibility_choice.rb +13 -0
- data/lib/openxml/docx/elements/markup_compatibility_fallback.rb +10 -0
- data/lib/openxml/docx/elements/paper_source.rb +4 -2
- data/lib/openxml/docx/elements/section_properties.rb +9 -0
- data/lib/openxml/docx/elements/symbol.rb +4 -2
- data/lib/openxml/docx/elements/table.rb +1 -1
- data/lib/openxml/docx/elements/table_cell.rb +2 -1
- data/lib/openxml/docx/elements/table_row.rb +7 -5
- data/lib/openxml/docx/elements/text.rb +1 -10
- data/lib/openxml/docx/elements/vml_container.rb +10 -0
- data/lib/openxml/docx/elements/word_processing_drawing_anchor.rb +23 -0
- data/lib/openxml/docx/elements/word_processing_drawing_effect_extent.rb +16 -0
- data/lib/openxml/docx/elements/word_processing_drawing_extent.rb +14 -0
- data/lib/openxml/docx/elements/word_processing_drawing_nv_graphic_frame_properties.rb +11 -0
- data/lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb +17 -0
- data/lib/openxml/docx/elements/word_processing_drawing_position_h.rb +23 -0
- data/lib/openxml/docx/elements/word_processing_drawing_position_offset.rb +10 -0
- data/lib/openxml/docx/elements/word_processing_drawing_position_v.rb +23 -0
- data/lib/openxml/docx/elements/word_processing_drawing_simple_position.rb +13 -0
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_none.rb +10 -0
- data/lib/openxml/docx/elements/word_processing_shapes_body_properties.rb +58 -0
- data/lib/openxml/docx/elements/word_processing_shapes_shape.rb +12 -0
- data/lib/openxml/docx/elements/word_processing_shapes_shape_properties.rb +23 -0
- data/lib/openxml/docx/package.rb +73 -1
- data/lib/openxml/docx/parts/document.rb +6 -24
- data/lib/openxml/docx/parts/fonts.rb +35 -0
- data/lib/openxml/docx/parts/footer.rb +32 -0
- data/lib/openxml/docx/parts/header.rb +32 -0
- data/lib/openxml/docx/parts/settings.rb +6 -2
- data/lib/openxml/docx/parts/styles.rb +5 -6
- data/lib/openxml/docx/properties.rb +0 -1
- data/lib/openxml/docx/properties/alignment.rb +1 -1
- data/lib/openxml/docx/properties/base_property.rb +13 -0
- data/lib/openxml/docx/properties/border.rb +11 -9
- data/lib/openxml/docx/properties/color.rb +6 -4
- data/lib/openxml/docx/properties/column.rb +4 -2
- data/lib/openxml/docx/properties/columns.rb +6 -4
- data/lib/openxml/docx/properties/complex_property.rb +1 -1
- data/lib/openxml/docx/properties/conditional_formatting.rb +14 -12
- data/lib/openxml/docx/properties/document_grid.rb +4 -10
- data/lib/openxml/docx/properties/east_asian_layout.rb +6 -11
- data/lib/openxml/docx/properties/font.rb +18 -22
- data/lib/openxml/docx/properties/footer_reference.rb +21 -0
- data/lib/openxml/docx/properties/frame.rb +16 -47
- data/lib/openxml/docx/properties/header_reference.rb +21 -0
- data/lib/openxml/docx/properties/indentation.rb +11 -8
- data/lib/openxml/docx/properties/language.rb +5 -3
- data/lib/openxml/docx/properties/latent_styles.rb +9 -6
- data/lib/openxml/docx/properties/latent_styles_exception.rb +9 -6
- data/lib/openxml/docx/properties/line_numbering.rb +5 -11
- data/lib/openxml/docx/properties/manual_width.rb +4 -2
- data/lib/openxml/docx/properties/numbering.rb +4 -2
- data/lib/openxml/docx/properties/page_borders.rb +6 -19
- data/lib/openxml/docx/properties/page_margins.rb +10 -7
- data/lib/openxml/docx/properties/page_numbering.rb +66 -74
- data/lib/openxml/docx/properties/page_size.rb +5 -12
- data/lib/openxml/docx/properties/shading.rb +46 -52
- data/lib/openxml/docx/properties/spacing.rb +9 -14
- data/lib/openxml/docx/properties/table_border.rb +12 -10
- data/lib/openxml/docx/properties/table_cell_border.rb +12 -10
- data/lib/openxml/docx/properties/table_cell_margin.rb +6 -4
- data/lib/openxml/docx/properties/table_cell_spacing.rb +5 -3
- data/lib/openxml/docx/properties/table_cell_width.rb +5 -3
- data/lib/openxml/docx/properties/table_indent.rb +5 -3
- data/lib/openxml/docx/properties/table_layout.rb +2 -4
- data/lib/openxml/docx/properties/table_look.rb +8 -6
- data/lib/openxml/docx/properties/table_p_pr.rb +11 -30
- data/lib/openxml/docx/properties/table_row_height.rb +13 -0
- data/lib/openxml/docx/properties/table_width.rb +5 -3
- data/lib/openxml/docx/properties/underline.rb +13 -12
- data/lib/openxml/docx/properties/wafter.rb +5 -3
- data/lib/openxml/docx/properties/wbefore.rb +5 -3
- data/lib/openxml/docx/root_namespaces.rb +74 -0
- data/lib/openxml/docx/section.rb +2 -0
- data/lib/openxml/docx/style.rb +4 -4
- data/lib/openxml/docx/version.rb +1 -1
- data/lib/openxml/drawingml.rb +17 -0
- data/lib/openxml/drawingml/elements.rb +13 -0
- data/lib/openxml/drawingml/elements/adjust_values_list.rb +11 -0
- data/lib/openxml/drawingml/elements/blip_fill.rb +14 -0
- data/lib/openxml/drawingml/elements/extension.rb +13 -0
- data/lib/openxml/drawingml/elements/extension_list.rb +11 -0
- data/lib/openxml/drawingml/elements/extents.rb +14 -0
- data/lib/openxml/drawingml/elements/graphic.rb +10 -0
- data/lib/openxml/drawingml/elements/graphic_data.rb +12 -0
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +17 -0
- data/lib/openxml/drawingml/elements/head_end.rb +28 -0
- data/lib/openxml/drawingml/elements/no_fill.rb +10 -0
- data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +17 -0
- data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +12 -0
- data/lib/openxml/drawingml/elements/non_visual_picture_properties.rb +10 -0
- data/lib/openxml/drawingml/elements/offset.rb +14 -0
- data/lib/openxml/drawingml/elements/outline.rb +36 -0
- data/lib/openxml/drawingml/elements/picture.rb +10 -0
- data/lib/openxml/drawingml/elements/preset_geometry.rb +210 -0
- data/lib/openxml/drawingml/elements/round.rb +10 -0
- data/lib/openxml/drawingml/elements/shape_guide.rb +40 -0
- data/lib/openxml/drawingml/elements/solid_fill.rb +10 -0
- data/lib/openxml/drawingml/elements/srgb_color.rb +14 -0
- data/lib/openxml/drawingml/elements/tail_end.rb +28 -0
- data/lib/openxml/drawingml/elements/transform_effect.rb +18 -0
- data/lib/openxml/drawingml/elements/wordprocessing_shape_group.rb +11 -0
- data/lib/openxml/vml.rb +17 -0
- data/lib/openxml/vml/elements.rb +13 -0
- data/lib/openxml/vml/elements/group.rb +88 -0
- data/lib/openxml/vml/elements/rectangle.rb +115 -0
- data/lib/openxml/vml/elements/rounded_rectangle.rb +121 -0
- data/openxml-docx.gemspec +1 -1
- data/spec/elements/absolute_position_tab_spec.rb +15 -47
- data/spec/elements/bidi_embed_spec.rb +4 -8
- data/spec/elements/bidi_override_spec.rb +4 -8
- data/spec/elements/break_spec.rb +8 -31
- data/spec/elements/content_part_spec.rb +2 -2
- data/spec/elements/control_spec.rb +6 -6
- data/spec/elements/deleted_text_spec.rb +2 -2
- data/spec/elements/drawing_spec.rb +11 -0
- data/spec/elements/drawingml/adjust_values_list_spec.rb +8 -0
- data/spec/elements/drawingml/blip_fill_spec.rb +34 -0
- data/spec/elements/drawingml/extension_list_spec.rb +8 -0
- data/spec/elements/drawingml/extension_spec.rb +19 -0
- data/spec/elements/drawingml/extents_spec.rb +33 -0
- data/spec/elements/drawingml/graphic_data_spec.rb +19 -0
- data/spec/elements/drawingml/graphic_frame_locks_spec.rb +78 -0
- data/spec/elements/drawingml/graphic_spec.rb +8 -0
- data/spec/elements/drawingml/head_end_spec.rb +45 -0
- data/spec/elements/drawingml/no_fill_spec.rb +8 -0
- data/spec/elements/drawingml/non_visual_drawing_properties_spec.rb +63 -0
- data/spec/elements/drawingml/non_visual_picture_drawing_properties_spec.rb +18 -0
- data/spec/elements/drawingml/non_visual_picture_properties_spec.rb +8 -0
- data/spec/elements/drawingml/offset_spec.rb +32 -0
- data/spec/elements/drawingml/outline_spec.rb +58 -0
- data/spec/elements/drawingml/picture_spec.rb +8 -0
- data/spec/elements/drawingml/preset_geometry_spec.rb +19 -0
- data/spec/elements/drawingml/round_spec.rb +8 -0
- data/spec/elements/drawingml/shape_guide_spec.rb +49 -0
- data/spec/elements/drawingml/solid_fill_spec.rb +8 -0
- data/spec/elements/drawingml/srgb_color_spec.rb +20 -0
- data/spec/elements/drawingml/tail_end_spec.rb +44 -0
- data/spec/elements/drawingml/transform_effect_spec.rb +80 -0
- data/spec/elements/drawingml/wordprocessing_shape_group_spec.rb +12 -0
- data/spec/elements/group_shape_spec.rb +11 -0
- data/spec/elements/markup_compatibility_alternate_content_spec.rb +11 -0
- data/spec/elements/markup_compatibility_choice_spec.rb +22 -0
- data/spec/elements/markup_compatibility_fallback_spec.rb +11 -0
- data/spec/elements/section_properties_spec.rb +12 -0
- data/spec/elements/symbol_spec.rb +4 -7
- data/spec/elements/text_spec.rb +2 -2
- data/spec/elements/vml/group_spec.rb +542 -0
- data/spec/elements/vml/rectangle_spec.rb +739 -0
- data/spec/elements/vml/rounded_rectangle_spec.rb +656 -0
- data/spec/elements/vml_container_spec.rb +11 -0
- data/spec/elements/word_processing_drawing_anchor_spec.rb +40 -0
- data/spec/elements/word_processing_drawing_effect_extent_spec.rb +57 -0
- data/spec/elements/word_processing_drawing_extent_spec.rb +34 -0
- data/spec/elements/word_processing_drawing_nv_graphic_frame_properties_spec.rb +11 -0
- data/spec/elements/word_processing_drawing_object_nv_properties_spec.rb +67 -0
- data/spec/elements/word_processing_drawing_position_h_spec.rb +21 -0
- data/spec/elements/word_processing_drawing_position_v_spec.rb +21 -0
- data/spec/elements/word_processing_drawing_simple_position_spec.rb +34 -0
- data/spec/elements/word_processing_drawing_wrap_none_spec.rb +12 -0
- data/spec/elements/word_processing_shapes_body_properties_spec.rb +223 -0
- data/spec/elements/word_processing_shapes_shape_properties_spec.rb +21 -0
- data/spec/elements/word_processing_shapes_shape_spec.rb +23 -0
- data/spec/parts/footer_spec.rb +33 -0
- data/spec/parts/header_spec.rb +33 -0
- data/spec/properties/footer_reference_spec.rb +32 -0
- data/spec/properties/header_reference_spec.rb +32 -0
- data/spec/properties/page_numbering_spec.rb +1 -1
- data/spec/properties/{table_cell_fit_text.rb → table_cell_fit_text_spec.rb} +0 -0
- data/spec/properties/{table_cell_width.rb → table_cell_width_spec.rb} +0 -0
- data/spec/properties/table_layout_spec.rb +14 -12
- data/spec/properties/{table_row_height.rb → table_row_height_spec.rb} +0 -0
- data/spec/section_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/data/elements/grid_column_element.xml +1 -1
- data/spec/support/data/elements/table_grid_element.xml +1 -1
- data/spec/support/data/parts/document_with_children_part.xml +2 -1
- data/spec/support/data/parts/document_with_multiple_sections_part.xml +1 -1
- data/spec/support/data/parts/document_with_one_section_part.xml +1 -1
- data/spec/support/data/parts/empty_document_part.xml +1 -1
- data/spec/support/data/parts/empty_footer_part.xml +1 -0
- data/spec/support/data/parts/empty_header_part.xml +1 -0
- data/spec/support/data/parts/footer_with_children_part.xml +1 -0
- data/spec/support/data/parts/header_with_children_part.xml +1 -0
- data/spec/support/element_test_macros.rb +58 -9
- metadata +126 -9
- data/lib/openxml/docx/properties/tr_height.rb +0 -19
- data/lib/openxml/docx/properties/width_property.rb +0 -17
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingShapesShapeProperties do
|
4
|
+
include ElementTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :spPr, name: "word_processing_shapes_shape_properties"
|
7
|
+
|
8
|
+
for_attribute(:bwMode) do
|
9
|
+
allowed = %i(auto black blackGray blackWhite clr gray grayWhite hidden invGray ltGray white)
|
10
|
+
with_values(allowed) do
|
11
|
+
it_should_assign_successfully
|
12
|
+
it_should_output_regular_xml
|
13
|
+
end
|
14
|
+
|
15
|
+
with_value(:notRight) do
|
16
|
+
it_should_raise_an_exception
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Elements::WordProcessingShapesShape do
|
4
|
+
include ElementTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :wsp, name: "word_processing_shapes_shape"
|
7
|
+
|
8
|
+
with_no_attributes_set do
|
9
|
+
it_should_output "<wps:wsp/>", assign: false
|
10
|
+
end
|
11
|
+
|
12
|
+
for_attribute(:normalEastAsianFlow) do
|
13
|
+
with_value(true)do
|
14
|
+
it_should_assign_successfully
|
15
|
+
it_should_output_regular_xml
|
16
|
+
end
|
17
|
+
|
18
|
+
with_value("invalid") do
|
19
|
+
it_should_raise_an_exception
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Parts::Footer do
|
4
|
+
include PartTestMacros
|
5
|
+
|
6
|
+
context "with child elements" do
|
7
|
+
before(:each) do
|
8
|
+
@doc = described_class.new
|
9
|
+
paragraph = OpenXml::Docx::Elements::Paragraph.new
|
10
|
+
|
11
|
+
first_run = OpenXml::Docx::Elements::Run.new
|
12
|
+
first_run << OpenXml::Docx::Elements::Text.new("This is just a test run.")
|
13
|
+
paragraph << first_run
|
14
|
+
|
15
|
+
second_run = OpenXml::Docx::Elements::Run.new
|
16
|
+
second_run << OpenXml::Docx::Elements::Text.new("But this isn't!")
|
17
|
+
paragraph << second_run
|
18
|
+
|
19
|
+
doc << paragraph
|
20
|
+
end
|
21
|
+
|
22
|
+
it_should_output_correct_xml part: "footer_with_children"
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with no elements" do
|
26
|
+
before(:each) do
|
27
|
+
@doc = described_class.new
|
28
|
+
end
|
29
|
+
|
30
|
+
it_should_output_correct_xml part: "empty_footer"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Parts::Header do
|
4
|
+
include PartTestMacros
|
5
|
+
|
6
|
+
context "with child elements" do
|
7
|
+
before(:each) do
|
8
|
+
@doc = described_class.new
|
9
|
+
paragraph = OpenXml::Docx::Elements::Paragraph.new
|
10
|
+
|
11
|
+
first_run = OpenXml::Docx::Elements::Run.new
|
12
|
+
first_run << OpenXml::Docx::Elements::Text.new("This is just a test run.")
|
13
|
+
paragraph << first_run
|
14
|
+
|
15
|
+
second_run = OpenXml::Docx::Elements::Run.new
|
16
|
+
second_run << OpenXml::Docx::Elements::Text.new("But this isn't!")
|
17
|
+
paragraph << second_run
|
18
|
+
|
19
|
+
doc << paragraph
|
20
|
+
end
|
21
|
+
|
22
|
+
it_should_output_correct_xml part: "header_with_children"
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with no elements" do
|
26
|
+
before(:each) do
|
27
|
+
@doc = described_class.new
|
28
|
+
end
|
29
|
+
|
30
|
+
it_should_output_correct_xml part: "empty_header"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Properties::FooterReference do
|
4
|
+
include PropertyTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :footerReference, name: "footer_reference"
|
7
|
+
|
8
|
+
for_attribute(:id) do
|
9
|
+
with_value("rId25") do
|
10
|
+
it_should_assign_successfully
|
11
|
+
it_should_output "<w:footerReference r:id=\"rId25\"/>"
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_not_allow_invalid_value
|
15
|
+
it_should_not_allow_integers
|
16
|
+
end
|
17
|
+
|
18
|
+
for_attribute(:type) do
|
19
|
+
values = %i(default even first)
|
20
|
+
it_should_assign_and_output_xml values
|
21
|
+
it_should_not_allow_invalid_value
|
22
|
+
end
|
23
|
+
|
24
|
+
with_no_attributes_set do
|
25
|
+
it_should_output "", assign: false
|
26
|
+
end
|
27
|
+
|
28
|
+
with_these_attributes_set(id: "rId5", type: :default) do
|
29
|
+
it_should_output "<w:footerReference w:type=\"default\" r:id=\"rId5\"/>", assign: false
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Properties::HeaderReference do
|
4
|
+
include PropertyTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :headerReference, name: "header_reference"
|
7
|
+
|
8
|
+
for_attribute(:id) do
|
9
|
+
with_value("rId25") do
|
10
|
+
it_should_assign_successfully
|
11
|
+
it_should_output "<w:headerReference r:id=\"rId25\"/>"
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_not_allow_invalid_value
|
15
|
+
it_should_not_allow_integers
|
16
|
+
end
|
17
|
+
|
18
|
+
for_attribute(:type) do
|
19
|
+
values = %i(default even first)
|
20
|
+
it_should_assign_and_output_xml values
|
21
|
+
it_should_not_allow_invalid_value
|
22
|
+
end
|
23
|
+
|
24
|
+
with_no_attributes_set do
|
25
|
+
it_should_output "", assign: false
|
26
|
+
end
|
27
|
+
|
28
|
+
with_these_attributes_set(id: "rId5", type: :default) do
|
29
|
+
it_should_output "<w:headerReference w:type=\"default\" r:id=\"rId5\"/>", assign: false
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -48,7 +48,7 @@ describe OpenXml::Docx::Properties::PageNumbering do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
with_these_attributes_set(chapter_separator: :colon, chapter_style: 1, format: :taiwaneseCountingThousand, start: 2) do
|
51
|
-
it_should_output "<w:pgNumType w:chapSep=\"colon\" w:chapStyle=\"1\" w:
|
51
|
+
it_should_output "<w:pgNumType w:chapSep=\"colon\" w:chapStyle=\"1\" w:start=\"2\" w:fmt=\"taiwaneseCountingThousand\"/>", assign: false
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
File without changes
|
File without changes
|
@@ -1,22 +1,24 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe OpenXml::Docx::Properties::TableLayout do
|
4
|
-
include
|
4
|
+
include PropertyTestMacros
|
5
5
|
|
6
|
-
it_should_use tag: :tblLayout, name: "table_layout"
|
6
|
+
it_should_use tag: :tblLayout, name: "table_layout"
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
for_attribute(:type) do
|
9
|
+
with_value(:autofit) do
|
10
|
+
it_should_assign_successfully
|
11
|
+
it_should_output "<w:tblLayout w:type=\"autofit\"/>"
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
with_value(:fixed) do
|
15
|
+
it_should_assign_successfully
|
16
|
+
it_should_output "<w:tblLayout w:type=\"fixed\"/>"
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
with_value(:nope) do
|
20
|
+
it_should_raise_an_exception
|
21
|
+
end
|
20
22
|
end
|
21
23
|
|
22
24
|
end
|
File without changes
|
data/spec/section_spec.rb
CHANGED
@@ -5,6 +5,8 @@ describe OpenXml::Docx::Section do
|
|
5
5
|
|
6
6
|
it_should_have_property :columns
|
7
7
|
it_should_have_property :document_grid
|
8
|
+
it_should_have_property :footer_reference
|
9
|
+
it_should_have_property :header_reference
|
8
10
|
it_should_have_property :line_numbering
|
9
11
|
it_should_have_property :page_margins
|
10
12
|
it_should_have_property :page_borders
|
data/spec/spec_helper.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><w:document mc:Ignorable="w14 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" xmlns:pic="http://purl.oclc.org/ooxml/drawingml/main"><w:body><w:p><w:r><w:t>This is just a test run.</w:t></w:r><w:r><w:t>But this isn't!</w:t></w:r></w:p></w:body></w:document>
|
2
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
2
|
+
<w:document mc:Ignorable="w14 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" xmlns:pic="http://purl.oclc.org/ooxml/drawingml/main">
|
3
3
|
<w:body>
|
4
4
|
<w:p>
|
5
5
|
<w:sectPr>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
2
|
+
<w:document mc:Ignorable="w14 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" xmlns:pic="http://purl.oclc.org/ooxml/drawingml/main">
|
3
3
|
<w:body>
|
4
4
|
<w:p>
|
5
5
|
<w:r>
|
@@ -1 +1 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><w:document mc:Ignorable="w14 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" xmlns:pic="http://purl.oclc.org/ooxml/drawingml/main"><w:body/></w:document>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><w:ftr mc:Ignorable="w14 w15 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"/>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><w:hdr mc:Ignorable="w14 w15 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"/>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><w:ftr mc:Ignorable="w14 w15 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"><w:p><w:r><w:t>This is just a test run.</w:t></w:r><w:r><w:t>But this isn't!</w:t></w:r></w:p></w:ftr>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><w:hdr mc:Ignorable="w14 w15 wp14 a14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"><w:p><w:r><w:t>This is just a test run.</w:t></w:r><w:r><w:t>But this isn't!</w:t></w:r></w:p></w:hdr>
|
@@ -6,7 +6,7 @@ module ElementTestMacros
|
|
6
6
|
|
7
7
|
def xml(obj)
|
8
8
|
doc = Nokogiri::XML::Builder.new do |xml|
|
9
|
-
xml.root(
|
9
|
+
xml.root(root_namespaces) {
|
10
10
|
obj.to_xml(xml)
|
11
11
|
}
|
12
12
|
end.to_xml
|
@@ -14,7 +14,7 @@ module ElementTestMacros
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def doc_pattern
|
17
|
-
/<\?xml\sversion="1.0"\?>\n<root xmlns
|
17
|
+
/<\?xml\sversion="1.0"\?>\n<root (?:xmlns:\w+=".+?".?)+>\n\s+([^\s].+)\n<\/root>/m
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.included(base)
|
@@ -22,6 +22,30 @@ module ElementTestMacros
|
|
22
22
|
base.extend ClassMethods
|
23
23
|
end
|
24
24
|
|
25
|
+
def root_namespaces
|
26
|
+
{ "xmlns:wpc" => 'http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas',
|
27
|
+
"xmlns:mo" => 'http://schemas.microsoft.com/office/mac/office/2008/main',
|
28
|
+
"xmlns:mv" => 'urn:schemas-microsoft-com:mac:vml',
|
29
|
+
"xmlns:o" => 'urn:schemas-microsoft-com:office:office',
|
30
|
+
"xmlns:r" => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
|
31
|
+
"xmlns:m" => 'http://schemas.openxmlformats.org/officeDocument/2006/math',
|
32
|
+
"xmlns:v" => 'urn:schemas-microsoft-com:vml',
|
33
|
+
"xmlns:wp14" => 'http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing',
|
34
|
+
"xmlns:wp" => 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing',
|
35
|
+
"xmlns:w10" => 'urn:schemas-microsoft-com:office:word',
|
36
|
+
"xmlns:w14" => 'http://schemas.microsoft.com/office/word/2010/wordml',
|
37
|
+
"xmlns:wpg" => 'http://schemas.microsoft.com/office/word/2010/wordprocessingGroup',
|
38
|
+
"xmlns:wpi" => 'http://schemas.microsoft.com/office/word/2010/wordprocessingInk',
|
39
|
+
"xmlns:wne" => 'http://schemas.microsoft.com/office/word/2006/wordml',
|
40
|
+
"xmlns:wps" => 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape',
|
41
|
+
"xmlns:w" => "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
42
|
+
"xmlns:mc" => "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
43
|
+
"xmlns:a" => "http://schemas.openxmlformats.org/drawingml/2006/main",
|
44
|
+
"xmlns:a14" => "http://schemas.microsoft.com/office/drawing/2010/main",
|
45
|
+
"xmlns:pic" => "http://purl.oclc.org/ooxml/drawingml/main",
|
46
|
+
"mc:Ignorable" => "w14 wp14 a14" }
|
47
|
+
end
|
48
|
+
|
25
49
|
module ClassMethods
|
26
50
|
|
27
51
|
def it_should_output_correct_xml(node_xml: nil)
|
@@ -61,25 +85,31 @@ module ElementTestMacros
|
|
61
85
|
end
|
62
86
|
end
|
63
87
|
|
64
|
-
def for_attribute(attribute, &block)
|
88
|
+
def for_attribute(attribute, displays_as: nil, with_namespace: nil, &block)
|
65
89
|
attribute_context = context "for the #{attribute} attribute" do
|
66
90
|
before(:each) do
|
67
91
|
@attribute = attribute
|
92
|
+
@display = displays_as
|
93
|
+
@namespace = with_namespace
|
68
94
|
end
|
69
95
|
end
|
70
96
|
|
71
97
|
attribute_context.class_eval &block
|
72
98
|
end
|
73
99
|
|
74
|
-
def with_value(
|
75
|
-
|
76
|
-
|
77
|
-
|
100
|
+
def with_value(values, &block)
|
101
|
+
values = [values] unless values.respond_to?(:each)
|
102
|
+
values.each do |value|
|
103
|
+
value_context = context "with the value as #{value}" do
|
104
|
+
before(:each) do
|
105
|
+
@value = value
|
106
|
+
end
|
78
107
|
end
|
79
|
-
end
|
80
108
|
|
81
|
-
|
109
|
+
value_context.class_eval &block
|
110
|
+
end
|
82
111
|
end
|
112
|
+
alias :with_values :with_value
|
83
113
|
|
84
114
|
def it_should_assign_successfully(*args)
|
85
115
|
it "should assign successfully" do
|
@@ -110,6 +140,25 @@ module ElementTestMacros
|
|
110
140
|
end
|
111
141
|
end
|
112
142
|
|
143
|
+
def it_should_output_regular_xml(*args, assign: true)
|
144
|
+
it "should output the expected regular XML" do
|
145
|
+
@instance = described_class.new *args
|
146
|
+
if assign
|
147
|
+
instance.send "#{attribute}=", value
|
148
|
+
end
|
149
|
+
|
150
|
+
tag = instance.tag
|
151
|
+
tag = "#{instance.namespace}:#{tag}" unless instance.namespace.nil?
|
152
|
+
attr_name = @display
|
153
|
+
attr_name = attribute if attr_name.nil?
|
154
|
+
attr_name = "#{@namespace}:#{attr_name}" unless @namespace.nil?
|
155
|
+
expected_xml = "<#{tag} #{attr_name}=\"#{value}\"/>"
|
156
|
+
expected_xml = "<#{tag}/>" if value == false
|
157
|
+
|
158
|
+
expect(xml(instance)).to eq(expected_xml)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
113
162
|
def with_no_attributes_set(args: nil, &block)
|
114
163
|
attribute_context = context "with no attributes set, it" do
|
115
164
|
before(:each) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openxml-docx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene Doyel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.
|
40
|
+
version: 0.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- README.md
|
138
138
|
- Rakefile
|
139
139
|
- examples/base
|
140
|
+
- examples/drawing-ml
|
140
141
|
- examples/table
|
141
142
|
- lib/openxml-docx.rb
|
142
143
|
- lib/openxml/docx.rb
|
@@ -152,12 +153,23 @@ files:
|
|
152
153
|
- lib/openxml/docx/elements/control.rb
|
153
154
|
- lib/openxml/docx/elements/deleted_text.rb
|
154
155
|
- lib/openxml/docx/elements/dirty.rb
|
156
|
+
- lib/openxml/docx/elements/drawing.rb
|
155
157
|
- lib/openxml/docx/elements/element.rb
|
158
|
+
- lib/openxml/docx/elements/embed_bold.rb
|
159
|
+
- lib/openxml/docx/elements/embed_bold_italic.rb
|
160
|
+
- lib/openxml/docx/elements/embed_italic.rb
|
161
|
+
- lib/openxml/docx/elements/embed_regular.rb
|
162
|
+
- lib/openxml/docx/elements/family.rb
|
163
|
+
- lib/openxml/docx/elements/font.rb
|
156
164
|
- lib/openxml/docx/elements/grid_column.rb
|
165
|
+
- lib/openxml/docx/elements/group_shape.rb
|
157
166
|
- lib/openxml/docx/elements/last_rendered_page_break.rb
|
158
167
|
- lib/openxml/docx/elements/long_day.rb
|
159
168
|
- lib/openxml/docx/elements/long_month.rb
|
160
169
|
- lib/openxml/docx/elements/long_year.rb
|
170
|
+
- lib/openxml/docx/elements/markup_compatibility_alternate_content.rb
|
171
|
+
- lib/openxml/docx/elements/markup_compatibility_choice.rb
|
172
|
+
- lib/openxml/docx/elements/markup_compatibility_fallback.rb
|
161
173
|
- lib/openxml/docx/elements/nonbreaking_hyphen.rb
|
162
174
|
- lib/openxml/docx/elements/optional_hyphen.rb
|
163
175
|
- lib/openxml/docx/elements/page_number.rb
|
@@ -165,6 +177,7 @@ files:
|
|
165
177
|
- lib/openxml/docx/elements/paragraph.rb
|
166
178
|
- lib/openxml/docx/elements/ruby.rb
|
167
179
|
- lib/openxml/docx/elements/run.rb
|
180
|
+
- lib/openxml/docx/elements/section_properties.rb
|
168
181
|
- lib/openxml/docx/elements/short_day.rb
|
169
182
|
- lib/openxml/docx/elements/short_month.rb
|
170
183
|
- lib/openxml/docx/elements/short_year.rb
|
@@ -175,9 +188,26 @@ files:
|
|
175
188
|
- lib/openxml/docx/elements/table_grid.rb
|
176
189
|
- lib/openxml/docx/elements/table_row.rb
|
177
190
|
- lib/openxml/docx/elements/text.rb
|
191
|
+
- lib/openxml/docx/elements/vml_container.rb
|
192
|
+
- lib/openxml/docx/elements/word_processing_drawing_anchor.rb
|
193
|
+
- lib/openxml/docx/elements/word_processing_drawing_effect_extent.rb
|
194
|
+
- lib/openxml/docx/elements/word_processing_drawing_extent.rb
|
195
|
+
- lib/openxml/docx/elements/word_processing_drawing_nv_graphic_frame_properties.rb
|
196
|
+
- lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb
|
197
|
+
- lib/openxml/docx/elements/word_processing_drawing_position_h.rb
|
198
|
+
- lib/openxml/docx/elements/word_processing_drawing_position_offset.rb
|
199
|
+
- lib/openxml/docx/elements/word_processing_drawing_position_v.rb
|
200
|
+
- lib/openxml/docx/elements/word_processing_drawing_simple_position.rb
|
201
|
+
- lib/openxml/docx/elements/word_processing_drawing_wrap_none.rb
|
202
|
+
- lib/openxml/docx/elements/word_processing_shapes_body_properties.rb
|
203
|
+
- lib/openxml/docx/elements/word_processing_shapes_shape.rb
|
204
|
+
- lib/openxml/docx/elements/word_processing_shapes_shape_properties.rb
|
178
205
|
- lib/openxml/docx/package.rb
|
179
206
|
- lib/openxml/docx/parts.rb
|
180
207
|
- lib/openxml/docx/parts/document.rb
|
208
|
+
- lib/openxml/docx/parts/fonts.rb
|
209
|
+
- lib/openxml/docx/parts/footer.rb
|
210
|
+
- lib/openxml/docx/parts/header.rb
|
181
211
|
- lib/openxml/docx/parts/settings.rb
|
182
212
|
- lib/openxml/docx/parts/styles.rb
|
183
213
|
- lib/openxml/docx/properties.rb
|
@@ -215,12 +245,14 @@ files:
|
|
215
245
|
- lib/openxml/docx/properties/expansion.rb
|
216
246
|
- lib/openxml/docx/properties/font.rb
|
217
247
|
- lib/openxml/docx/properties/font_size.rb
|
248
|
+
- lib/openxml/docx/properties/footer_reference.rb
|
218
249
|
- lib/openxml/docx/properties/form_protection.rb
|
219
250
|
- lib/openxml/docx/properties/frame.rb
|
220
251
|
- lib/openxml/docx/properties/grid_after.rb
|
221
252
|
- lib/openxml/docx/properties/grid_before.rb
|
222
253
|
- lib/openxml/docx/properties/grid_span.rb
|
223
254
|
- lib/openxml/docx/properties/header.rb
|
255
|
+
- lib/openxml/docx/properties/header_reference.rb
|
224
256
|
- lib/openxml/docx/properties/headers.rb
|
225
257
|
- lib/openxml/docx/properties/hidden.rb
|
226
258
|
- lib/openxml/docx/properties/hidden_style.rb
|
@@ -310,6 +342,7 @@ files:
|
|
310
342
|
- lib/openxml/docx/properties/table_look.rb
|
311
343
|
- lib/openxml/docx/properties/table_overlap.rb
|
312
344
|
- lib/openxml/docx/properties/table_p_pr.rb
|
345
|
+
- lib/openxml/docx/properties/table_row_height.rb
|
313
346
|
- lib/openxml/docx/properties/table_style.rb
|
314
347
|
- lib/openxml/docx/properties/table_width.rb
|
315
348
|
- lib/openxml/docx/properties/tabs.rb
|
@@ -317,7 +350,6 @@ files:
|
|
317
350
|
- lib/openxml/docx/properties/text_direction.rb
|
318
351
|
- lib/openxml/docx/properties/textbox_tight_wrap.rb
|
319
352
|
- lib/openxml/docx/properties/toggle_property.rb
|
320
|
-
- lib/openxml/docx/properties/tr_height.rb
|
321
353
|
- lib/openxml/docx/properties/ui_priority.rb
|
322
354
|
- lib/openxml/docx/properties/underline.rb
|
323
355
|
- lib/openxml/docx/properties/unhide_when_used.rb
|
@@ -329,12 +361,43 @@ files:
|
|
329
361
|
- lib/openxml/docx/properties/wbefore.rb
|
330
362
|
- lib/openxml/docx/properties/web_hidden.rb
|
331
363
|
- lib/openxml/docx/properties/widow_control.rb
|
332
|
-
- lib/openxml/docx/properties/width_property.rb
|
333
364
|
- lib/openxml/docx/properties/word_wrap.rb
|
334
365
|
- lib/openxml/docx/property_builder.rb
|
366
|
+
- lib/openxml/docx/root_namespaces.rb
|
335
367
|
- lib/openxml/docx/section.rb
|
336
368
|
- lib/openxml/docx/style.rb
|
337
369
|
- lib/openxml/docx/version.rb
|
370
|
+
- lib/openxml/drawingml.rb
|
371
|
+
- lib/openxml/drawingml/elements.rb
|
372
|
+
- lib/openxml/drawingml/elements/adjust_values_list.rb
|
373
|
+
- lib/openxml/drawingml/elements/blip_fill.rb
|
374
|
+
- lib/openxml/drawingml/elements/extension.rb
|
375
|
+
- lib/openxml/drawingml/elements/extension_list.rb
|
376
|
+
- lib/openxml/drawingml/elements/extents.rb
|
377
|
+
- lib/openxml/drawingml/elements/graphic.rb
|
378
|
+
- lib/openxml/drawingml/elements/graphic_data.rb
|
379
|
+
- lib/openxml/drawingml/elements/graphic_frame_locks.rb
|
380
|
+
- lib/openxml/drawingml/elements/head_end.rb
|
381
|
+
- lib/openxml/drawingml/elements/no_fill.rb
|
382
|
+
- lib/openxml/drawingml/elements/non_visual_drawing_properties.rb
|
383
|
+
- lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb
|
384
|
+
- lib/openxml/drawingml/elements/non_visual_picture_properties.rb
|
385
|
+
- lib/openxml/drawingml/elements/offset.rb
|
386
|
+
- lib/openxml/drawingml/elements/outline.rb
|
387
|
+
- lib/openxml/drawingml/elements/picture.rb
|
388
|
+
- lib/openxml/drawingml/elements/preset_geometry.rb
|
389
|
+
- lib/openxml/drawingml/elements/round.rb
|
390
|
+
- lib/openxml/drawingml/elements/shape_guide.rb
|
391
|
+
- lib/openxml/drawingml/elements/solid_fill.rb
|
392
|
+
- lib/openxml/drawingml/elements/srgb_color.rb
|
393
|
+
- lib/openxml/drawingml/elements/tail_end.rb
|
394
|
+
- lib/openxml/drawingml/elements/transform_effect.rb
|
395
|
+
- lib/openxml/drawingml/elements/wordprocessing_shape_group.rb
|
396
|
+
- lib/openxml/vml.rb
|
397
|
+
- lib/openxml/vml/elements.rb
|
398
|
+
- lib/openxml/vml/elements/group.rb
|
399
|
+
- lib/openxml/vml/elements/rectangle.rb
|
400
|
+
- lib/openxml/vml/elements/rounded_rectangle.rb
|
338
401
|
- openxml-docx.gemspec
|
339
402
|
- spec/elements/absolute_position_tab_spec.rb
|
340
403
|
- spec/elements/bidi_embed_spec.rb
|
@@ -345,17 +408,47 @@ files:
|
|
345
408
|
- spec/elements/control_spec.rb
|
346
409
|
- spec/elements/deleted_text_spec.rb
|
347
410
|
- spec/elements/dirty_spec.rb
|
411
|
+
- spec/elements/drawing_spec.rb
|
412
|
+
- spec/elements/drawingml/adjust_values_list_spec.rb
|
413
|
+
- spec/elements/drawingml/blip_fill_spec.rb
|
414
|
+
- spec/elements/drawingml/extension_list_spec.rb
|
415
|
+
- spec/elements/drawingml/extension_spec.rb
|
416
|
+
- spec/elements/drawingml/extents_spec.rb
|
417
|
+
- spec/elements/drawingml/graphic_data_spec.rb
|
418
|
+
- spec/elements/drawingml/graphic_frame_locks_spec.rb
|
419
|
+
- spec/elements/drawingml/graphic_spec.rb
|
420
|
+
- spec/elements/drawingml/head_end_spec.rb
|
421
|
+
- spec/elements/drawingml/no_fill_spec.rb
|
422
|
+
- spec/elements/drawingml/non_visual_drawing_properties_spec.rb
|
423
|
+
- spec/elements/drawingml/non_visual_picture_drawing_properties_spec.rb
|
424
|
+
- spec/elements/drawingml/non_visual_picture_properties_spec.rb
|
425
|
+
- spec/elements/drawingml/offset_spec.rb
|
426
|
+
- spec/elements/drawingml/outline_spec.rb
|
427
|
+
- spec/elements/drawingml/picture_spec.rb
|
428
|
+
- spec/elements/drawingml/preset_geometry_spec.rb
|
429
|
+
- spec/elements/drawingml/round_spec.rb
|
430
|
+
- spec/elements/drawingml/shape_guide_spec.rb
|
431
|
+
- spec/elements/drawingml/solid_fill_spec.rb
|
432
|
+
- spec/elements/drawingml/srgb_color_spec.rb
|
433
|
+
- spec/elements/drawingml/tail_end_spec.rb
|
434
|
+
- spec/elements/drawingml/transform_effect_spec.rb
|
435
|
+
- spec/elements/drawingml/wordprocessing_shape_group_spec.rb
|
348
436
|
- spec/elements/grid_column_spec.rb
|
437
|
+
- spec/elements/group_shape_spec.rb
|
349
438
|
- spec/elements/last_rendered_page_break_spec.rb
|
350
439
|
- spec/elements/long_day_spec.rb
|
351
440
|
- spec/elements/long_month_spec.rb
|
352
441
|
- spec/elements/long_year_spec.rb
|
442
|
+
- spec/elements/markup_compatibility_alternate_content_spec.rb
|
443
|
+
- spec/elements/markup_compatibility_choice_spec.rb
|
444
|
+
- spec/elements/markup_compatibility_fallback_spec.rb
|
353
445
|
- spec/elements/nonbreaking_hyphen_spec.rb
|
354
446
|
- spec/elements/optional_hyphen_spec.rb
|
355
447
|
- spec/elements/page_number_spec.rb
|
356
448
|
- spec/elements/paragraph_spec.rb
|
357
449
|
- spec/elements/ruby_spec.rb
|
358
450
|
- spec/elements/run_spec.rb
|
451
|
+
- spec/elements/section_properties_spec.rb
|
359
452
|
- spec/elements/short_day_spec.rb
|
360
453
|
- spec/elements/short_month_spec.rb
|
361
454
|
- spec/elements/short_year_spec.rb
|
@@ -366,8 +459,26 @@ files:
|
|
366
459
|
- spec/elements/table_row_spec.rb
|
367
460
|
- spec/elements/table_spec.rb
|
368
461
|
- spec/elements/text_spec.rb
|
462
|
+
- spec/elements/vml/group_spec.rb
|
463
|
+
- spec/elements/vml/rectangle_spec.rb
|
464
|
+
- spec/elements/vml/rounded_rectangle_spec.rb
|
465
|
+
- spec/elements/vml_container_spec.rb
|
466
|
+
- spec/elements/word_processing_drawing_anchor_spec.rb
|
467
|
+
- spec/elements/word_processing_drawing_effect_extent_spec.rb
|
468
|
+
- spec/elements/word_processing_drawing_extent_spec.rb
|
469
|
+
- spec/elements/word_processing_drawing_nv_graphic_frame_properties_spec.rb
|
470
|
+
- spec/elements/word_processing_drawing_object_nv_properties_spec.rb
|
471
|
+
- spec/elements/word_processing_drawing_position_h_spec.rb
|
472
|
+
- spec/elements/word_processing_drawing_position_v_spec.rb
|
473
|
+
- spec/elements/word_processing_drawing_simple_position_spec.rb
|
474
|
+
- spec/elements/word_processing_drawing_wrap_none_spec.rb
|
475
|
+
- spec/elements/word_processing_shapes_body_properties_spec.rb
|
476
|
+
- spec/elements/word_processing_shapes_shape_properties_spec.rb
|
477
|
+
- spec/elements/word_processing_shapes_shape_spec.rb
|
369
478
|
- spec/package_spec.rb
|
370
479
|
- spec/parts/document_spec.rb
|
480
|
+
- spec/parts/footer_spec.rb
|
481
|
+
- spec/parts/header_spec.rb
|
371
482
|
- spec/parts/settings_spec.rb
|
372
483
|
- spec/parts/styles_spec.rb
|
373
484
|
- spec/properties/alignment_spec.rb
|
@@ -400,11 +511,13 @@ files:
|
|
400
511
|
- spec/properties/expansion_spec.rb
|
401
512
|
- spec/properties/font_size_spec.rb
|
402
513
|
- spec/properties/font_spec.rb
|
514
|
+
- spec/properties/footer_reference_spec.rb
|
403
515
|
- spec/properties/form_protection_spec.rb
|
404
516
|
- spec/properties/frame_spec.rb
|
405
517
|
- spec/properties/grid_after_spec.rb
|
406
518
|
- spec/properties/grid_before_spec.rb
|
407
519
|
- spec/properties/grid_span_spec.rb
|
520
|
+
- spec/properties/header_reference_spec.rb
|
408
521
|
- spec/properties/header_spec.rb
|
409
522
|
- spec/properties/headers_spec.rb
|
410
523
|
- spec/properties/hidden_spec.rb
|
@@ -479,11 +592,11 @@ files:
|
|
479
592
|
- spec/properties/table_cell_border_spec.rb
|
480
593
|
- spec/properties/table_cell_borders_spec.rb
|
481
594
|
- spec/properties/table_cell_cell_margin_spec.rb
|
482
|
-
- spec/properties/
|
595
|
+
- spec/properties/table_cell_fit_text_spec.rb
|
483
596
|
- spec/properties/table_cell_margin_spec.rb
|
484
597
|
- spec/properties/table_cell_margins_spec.rb
|
485
598
|
- spec/properties/table_cell_spacing_spec.rb
|
486
|
-
- spec/properties/
|
599
|
+
- spec/properties/table_cell_width_spec.rb
|
487
600
|
- spec/properties/table_description_spec.rb
|
488
601
|
- spec/properties/table_header_spec.rb
|
489
602
|
- spec/properties/table_indent_spec.rb
|
@@ -491,7 +604,7 @@ files:
|
|
491
604
|
- spec/properties/table_look_spec.rb
|
492
605
|
- spec/properties/table_overlap_spec.rb
|
493
606
|
- spec/properties/table_p_pr_spec.rb
|
494
|
-
- spec/properties/
|
607
|
+
- spec/properties/table_row_height_spec.rb
|
495
608
|
- spec/properties/table_style_spec.rb
|
496
609
|
- spec/properties/table_width_spec.rb
|
497
610
|
- spec/properties/tabs_spec.rb
|
@@ -529,7 +642,11 @@ files:
|
|
529
642
|
- spec/support/data/parts/document_with_multiple_sections_part.xml
|
530
643
|
- spec/support/data/parts/document_with_one_section_part.xml
|
531
644
|
- spec/support/data/parts/empty_document_part.xml
|
645
|
+
- spec/support/data/parts/empty_footer_part.xml
|
646
|
+
- spec/support/data/parts/empty_header_part.xml
|
647
|
+
- spec/support/data/parts/footer_with_children_part.xml
|
532
648
|
- spec/support/data/parts/global_rels_part.xml
|
649
|
+
- spec/support/data/parts/header_with_children_part.xml
|
533
650
|
- spec/support/data/parts/rels_part.xml
|
534
651
|
- spec/support/data/parts/settings_part.xml
|
535
652
|
- spec/support/data/parts/styles_part.xml
|