openxml-docx 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/examples/booklet-printing +55 -0
- data/lib/openxml/docx/attribute_builder.rb +11 -5
- data/lib/openxml/docx/elements/absolute_position_tab.rb +1 -1
- data/lib/openxml/docx/elements/background.rb +16 -0
- data/lib/openxml/docx/elements/book_fold_printing.rb +1 -1
- data/lib/openxml/docx/elements/book_fold_reverse_printing.rb +1 -1
- data/lib/openxml/docx/elements/compatibility_setting.rb +10 -0
- data/lib/openxml/docx/elements/compatibility_settings.rb +15 -0
- data/lib/openxml/docx/elements/embed_bold.rb +2 -10
- data/lib/openxml/docx/elements/embed_bold_italic.rb +2 -10
- data/lib/openxml/docx/elements/embed_italic.rb +2 -10
- data/lib/openxml/docx/elements/embed_regular.rb +3 -3
- data/lib/openxml/docx/elements/embed_system_fonts.rb +1 -1
- data/lib/openxml/docx/elements/embed_true_type_fonts.rb +1 -1
- data/lib/openxml/docx/elements/even_and_odd_headers.rb +11 -0
- data/lib/openxml/docx/elements/family.rb +1 -1
- data/lib/openxml/docx/elements/markup_compatibility_choice.rb +1 -1
- data/lib/openxml/docx/elements/paragraph.rb +1 -0
- data/lib/openxml/docx/elements/save_subset_fonts.rb +1 -1
- data/lib/openxml/docx/elements/table_cell.rb +1 -0
- data/lib/openxml/docx/elements/textbox_content.rb +9 -0
- data/lib/openxml/docx/elements/word_processing_drawing_anchor.rb +6 -6
- data/lib/openxml/docx/elements/word_processing_drawing_inline.rb +16 -0
- data/lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_polygon.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_shapes_body_properties.rb +12 -12
- data/lib/openxml/docx/elements/word_processing_shapes_nv_drawing_properties.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_shapes_shape.rb +1 -2
- data/lib/openxml/docx/elements/word_processing_shapes_shape_properties.rb +1 -11
- data/lib/openxml/docx/elements/word_processing_shapes_textual_contents.rb +13 -0
- data/lib/openxml/{drawingml → docx}/elements/wordprocessing_shape_group.rb +1 -1
- data/lib/openxml/docx/package.rb +4 -3
- data/lib/openxml/docx/parts/document.rb +5 -0
- data/lib/openxml/docx/parts/header.rb +1 -1
- data/lib/openxml/docx/properties.rb +1 -0
- data/lib/openxml/docx/properties/border.rb +2 -2
- data/lib/openxml/docx/properties/columns.rb +8 -2
- data/lib/openxml/docx/properties/conditional_formatting.rb +12 -12
- data/lib/openxml/docx/properties/container_property.rb +10 -10
- data/lib/openxml/docx/properties/footer_references.rb +12 -0
- data/lib/openxml/docx/properties/frame.rb +1 -1
- data/lib/openxml/docx/properties/header_references.rb +12 -0
- data/lib/openxml/docx/properties/indentation.rb +5 -1
- data/lib/openxml/docx/properties/latent_styles.rb +4 -4
- data/lib/openxml/docx/properties/latent_styles_exception.rb +4 -4
- data/lib/openxml/docx/properties/section.rb +15 -0
- data/lib/openxml/docx/properties/table_border.rb +2 -2
- data/lib/openxml/docx/properties/table_cell_border.rb +2 -2
- data/lib/openxml/docx/properties/table_look.rb +7 -6
- data/lib/openxml/docx/properties/text_direction.rb +1 -1
- data/lib/openxml/docx/properties/transparent_container_property.rb +14 -0
- data/lib/openxml/docx/properties/vertical_merge.rb +14 -0
- data/lib/openxml/docx/section.rb +2 -0
- data/lib/openxml/docx/style.rb +18 -6
- data/lib/openxml/docx/version.rb +1 -1
- data/lib/openxml/drawingml/elements/blip_fill.rb +1 -1
- data/lib/openxml/drawingml/elements/children_extents.rb +14 -0
- data/lib/openxml/drawingml/elements/children_offset.rb +14 -0
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +6 -6
- data/lib/openxml/drawingml/elements/no_autofit.rb +10 -0
- data/lib/openxml/drawingml/elements/no_fill.rb +1 -1
- data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +1 -1
- data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +1 -1
- data/lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb +12 -0
- data/lib/openxml/drawingml/elements/picture_locks.rb +11 -11
- data/lib/openxml/drawingml/elements/preset_text_warp.rb +25 -0
- data/lib/openxml/vml/elements/group.rb +17 -37
- data/lib/openxml/vml/elements/rectangle.rb +29 -62
- data/lib/openxml/vml/elements/rounded_rectangle.rb +29 -61
- data/spec/elements/absolute_position_tab_spec.rb +21 -15
- data/spec/elements/background_spec.rb +52 -0
- data/spec/elements/bidi_embed_spec.rb +12 -4
- data/spec/elements/bidi_override_spec.rb +12 -4
- data/spec/elements/break_spec.rb +12 -10
- data/spec/elements/compatibility_setting_spec.rb +41 -0
- data/spec/elements/compatibility_settings_spec.rb +8 -0
- data/spec/elements/content_part_spec.rb +2 -2
- data/spec/elements/control_spec.rb +5 -5
- data/spec/elements/deleted_text_spec.rb +2 -2
- data/spec/elements/drawingml/blip_fill_spec.rb +8 -3
- data/spec/elements/drawingml/extents_spec.rb +4 -4
- data/spec/elements/drawingml/head_end_spec.rb +16 -13
- data/spec/elements/drawingml/no_autofit_spec.rb +8 -0
- data/spec/elements/drawingml/non_visual_drawing_properties_spec.rb +6 -6
- data/spec/elements/drawingml/non_visual_shape_drawing_properties_spec.rb +24 -0
- data/spec/elements/drawingml/offset_spec.rb +14 -4
- data/spec/elements/drawingml/outline_spec.rb +20 -14
- data/spec/elements/drawingml/preset_geometry_spec.rb +1 -1
- data/spec/elements/drawingml/preset_text_warp_spec.rb +36 -0
- data/spec/elements/drawingml/shape_guide_spec.rb +7 -3
- data/spec/elements/drawingml/srgb_color_spec.rb +3 -4
- data/spec/elements/drawingml/tail_end_spec.rb +17 -14
- data/spec/elements/drawingml/transform_effect_spec.rb +48 -26
- data/spec/elements/markup_compatibility_choice_spec.rb +2 -2
- data/spec/elements/paragraph_spec.rb +25 -0
- data/spec/elements/symbol_spec.rb +4 -4
- data/spec/elements/text_spec.rb +1 -1
- data/spec/elements/textbox_content_spec.rb +8 -0
- data/spec/elements/vml/group_spec.rb +367 -375
- data/spec/elements/vml/rectangle_spec.rb +503 -513
- data/spec/elements/vml/rounded_rectangle_spec.rb +591 -463
- data/spec/elements/word_processing_drawing_effect_extent_spec.rb +32 -12
- data/spec/elements/word_processing_drawing_extent_spec.rb +4 -4
- data/spec/elements/word_processing_drawing_object_nv_properties_spec.rb +6 -6
- data/spec/elements/word_processing_drawing_simple_position_spec.rb +16 -6
- data/spec/elements/word_processing_shapes_body_properties_spec.rb +53 -44
- data/spec/elements/word_processing_shapes_shape_properties_spec.rb +6 -5
- data/spec/elements/word_processing_shapes_shape_spec.rb +2 -2
- data/spec/elements/word_processing_shapes_textual_content_spec.rb +23 -0
- data/spec/elements/{drawingml/wordprocessing_shape_group_spec.rb → wordprocessing_shape_group_spec.rb} +1 -1
- data/spec/properties/indentation_spec.rb +28 -0
- data/spec/properties/table_look_spec.rb +5 -0
- data/spec/properties/text_direction_spec.rb +5 -0
- data/spec/properties/vertical_merge_spec.rb +22 -0
- data/spec/support/data/elements/paragraph_with_section_properties_element.xml +12 -0
- data/spec/support/data/parts/empty_header_part.xml +1 -1
- data/spec/support/data/parts/header_with_children_part.xml +1 -1
- metadata +76 -27
- checksums.yaml +0 -7
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::DrawingML::Elements::NonVisualShapeDrawingProperties do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
|
|
6
|
+
it_should_use tag: :cNvSpPr, name: "non_visual_shape_drawing_properties"
|
|
7
|
+
|
|
8
|
+
for_attribute(:textbox) do
|
|
9
|
+
with_value(true) do
|
|
10
|
+
it_should_assign_successfully
|
|
11
|
+
it_should_output "<wps:cNvSpPr txBox=\"true\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(false) do
|
|
15
|
+
it_should_assign_successfully
|
|
16
|
+
it_should_output "<wps:cNvSpPr txBox=\"false\"/>"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
with_value(:not_a_boolean) do
|
|
20
|
+
it_should_raise_an_exception
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -8,9 +8,14 @@ describe OpenXml::DrawingML::Elements::Offset do
|
|
|
8
8
|
attributes = %i(x y)
|
|
9
9
|
|
|
10
10
|
for_attribute(:x) do
|
|
11
|
-
|
|
11
|
+
with_value(1) do
|
|
12
12
|
it_should_assign_successfully
|
|
13
|
-
|
|
13
|
+
it_should_output "<a:off x=\"1\"/>"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
with_value(-1) do
|
|
17
|
+
it_should_assign_successfully
|
|
18
|
+
it_should_output "<a:off x=\"-1\"/>"
|
|
14
19
|
end
|
|
15
20
|
|
|
16
21
|
with_values([1.1, :not_a_number]) do
|
|
@@ -19,9 +24,14 @@ describe OpenXml::DrawingML::Elements::Offset do
|
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
for_attribute(:y) do
|
|
22
|
-
|
|
27
|
+
with_value(1) do
|
|
28
|
+
it_should_assign_successfully
|
|
29
|
+
it_should_output "<a:off y=\"1\"/>"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
with_value(-1) do
|
|
23
33
|
it_should_assign_successfully
|
|
24
|
-
|
|
34
|
+
it_should_output "<a:off y=\"-1\"/>"
|
|
25
35
|
end
|
|
26
36
|
|
|
27
37
|
with_values([1.1, :not_a_number]) do
|
|
@@ -5,11 +5,15 @@ describe OpenXml::DrawingML::Elements::Outline do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :ln, name: "outline"
|
|
7
7
|
|
|
8
|
-
for_attribute(:alignment
|
|
9
|
-
|
|
10
|
-
with_values(allowed) do
|
|
8
|
+
for_attribute(:alignment) do
|
|
9
|
+
with_value(:ctr) do
|
|
11
10
|
it_should_assign_successfully
|
|
12
|
-
|
|
11
|
+
it_should_output "<a:ln algn=\"ctr\"/>"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
with_value(:in) do
|
|
15
|
+
it_should_assign_successfully
|
|
16
|
+
it_should_output "<a:ln algn=\"in\"/>"
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
with_value(:not_ok) do
|
|
@@ -18,10 +22,11 @@ describe OpenXml::DrawingML::Elements::Outline do
|
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
for_attribute(:cap) do
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
%i(flat rnd sq).each do |allowed_value|
|
|
26
|
+
with_value(allowed_value) do
|
|
27
|
+
it_should_assign_successfully
|
|
28
|
+
it_should_output "<a:ln cap=\"#{allowed_value}\"/>"
|
|
29
|
+
end
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
with_value(:not_ok) do
|
|
@@ -29,11 +34,12 @@ describe OpenXml::DrawingML::Elements::Outline do
|
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
|
|
32
|
-
for_attribute(:compound_type
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
for_attribute(:compound_type) do
|
|
38
|
+
%i(dbl sng thickThin thinThick tri).each do |allowed_value|
|
|
39
|
+
with_value(allowed_value) do
|
|
40
|
+
it_should_assign_successfully
|
|
41
|
+
it_should_output "<a:ln cmpd=\"#{allowed_value}\"/>"
|
|
42
|
+
end
|
|
37
43
|
end
|
|
38
44
|
|
|
39
45
|
with_value(:not_ok) do
|
|
@@ -44,7 +50,7 @@ describe OpenXml::DrawingML::Elements::Outline do
|
|
|
44
50
|
for_attribute(:width, displays_as: :w) do
|
|
45
51
|
with_value(1) do
|
|
46
52
|
it_should_assign_successfully
|
|
47
|
-
|
|
53
|
+
it_should_output "<a:ln w=\"1\"/>"
|
|
48
54
|
end
|
|
49
55
|
|
|
50
56
|
with_values([1.1, -1]) do
|
|
@@ -8,7 +8,7 @@ describe OpenXml::DrawingML::Elements::PresetGeometry do
|
|
|
8
8
|
for_attribute(:preset, displays_as: :prst) do
|
|
9
9
|
with_value(:roundRect) do
|
|
10
10
|
it_should_assign_successfully
|
|
11
|
-
|
|
11
|
+
it_should_output "<a:prstGeom prst=\"roundRect\"/>"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
with_value(:invalidGeometry) do
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe OpenXml::DrawingML::Elements::PresetTextWarp do
|
|
4
|
+
include ElementTestMacros
|
|
5
|
+
it_should_use tag: :prstTxWarp, name: "preset_text_warp"
|
|
6
|
+
|
|
7
|
+
presets = %i(textArchDown textArchDownPour textArchUp
|
|
8
|
+
textArchUpPour textButton textButtonPour
|
|
9
|
+
textCanDown textCanUp textCascadeDown
|
|
10
|
+
textCascadeUp textChevron textChevronInverted
|
|
11
|
+
textCircle textCirclePour textCurveDown
|
|
12
|
+
textCurveUp textDeflate textDeflateBottom
|
|
13
|
+
textDeflateInflate textDeflateTop
|
|
14
|
+
textDoubleWave1 textFadeDown textFadeLeft
|
|
15
|
+
textFadeRight textFadeUp textInflate
|
|
16
|
+
textInflateBottom textInflateTop textNoShape
|
|
17
|
+
textPlain textRingInside textRingOutside
|
|
18
|
+
textSlantDown textSlantUp textStop textTriangle
|
|
19
|
+
textTriangleInverted textWave1 textWave2
|
|
20
|
+
textWave4)
|
|
21
|
+
|
|
22
|
+
for_attribute(:preset) do
|
|
23
|
+
presets.each do |preset|
|
|
24
|
+
with_value(preset) do
|
|
25
|
+
it_should_assign_successfully
|
|
26
|
+
it_should_output "<a:prstTxWarp prst=\"#{preset}\"/>"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
with_values([1, false, :incorrect]) do
|
|
31
|
+
it_should_raise_an_exception
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -23,10 +23,10 @@ describe OpenXml::DrawingML::Elements::ShapeGuide do
|
|
|
23
23
|
"tan h w",
|
|
24
24
|
"val 100" ] # Arguments to formulae can be a variable, a positive integer, or a negative integer
|
|
25
25
|
|
|
26
|
-
for_attribute(:guide_name
|
|
26
|
+
for_attribute(:guide_name) do
|
|
27
27
|
with_value("Some String") do
|
|
28
28
|
it_should_assign_successfully
|
|
29
|
-
|
|
29
|
+
it_should_output "<a:gd name=\"Some String\"/>"
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
with_values([1, :not_a_string]) do
|
|
@@ -37,7 +37,11 @@ describe OpenXml::DrawingML::Elements::ShapeGuide do
|
|
|
37
37
|
for_attribute(:formula, displays_as: :fmla) do
|
|
38
38
|
with_values(formulae) do
|
|
39
39
|
it_should_assign_successfully
|
|
40
|
-
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
with_value("*/ h 10 -100") do
|
|
43
|
+
it_should_assign_successfully
|
|
44
|
+
it_should_output "<a:gd fmla=\"*/ h 10 -100\"/>"
|
|
41
45
|
end
|
|
42
46
|
|
|
43
47
|
not_allowed = ["a^2 + b^2 = c^2", "Not a formula", 2 ]
|
|
@@ -5,14 +5,13 @@ describe OpenXml::DrawingML::Elements::SRGBColor do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :srgbClr, name: "srgb_color"
|
|
7
7
|
|
|
8
|
-
for_attribute(:value
|
|
8
|
+
for_attribute(:value) do
|
|
9
9
|
with_value("FFFFFF") do
|
|
10
10
|
it_should_assign_successfully
|
|
11
|
-
|
|
11
|
+
it_should_output "<a:srgbClr val=\"FFFFFF\"/>"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
with_values(not_allowed) do
|
|
14
|
+
with_values(["blue", :blue, 23]) do
|
|
16
15
|
it_should_raise_an_exception
|
|
17
16
|
end
|
|
18
17
|
end
|
|
@@ -5,11 +5,12 @@ describe OpenXml::DrawingML::Elements::TailEnd do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :tailEnd, name: "tail_end"
|
|
7
7
|
|
|
8
|
-
for_attribute(:length
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
for_attribute(:length) do
|
|
9
|
+
%i(lg med sm).each do |allowed_value|
|
|
10
|
+
with_value(allowed_value) do
|
|
11
|
+
it_should_assign_successfully
|
|
12
|
+
it_should_output "<a:tailEnd len=\"#{allowed_value}\"/>"
|
|
13
|
+
end
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
with_value(:bad_value) do
|
|
@@ -18,10 +19,11 @@ describe OpenXml::DrawingML::Elements::TailEnd do
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
for_attribute(:type) do
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
%i(arrow diamond none oval stealth triangle).each do |allowed_value|
|
|
23
|
+
with_value(allowed_value) do
|
|
24
|
+
it_should_assign_successfully
|
|
25
|
+
it_should_output "<a:tailEnd type=\"#{allowed_value}\"/>"
|
|
26
|
+
end
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
with_value(:bad_value) do
|
|
@@ -29,11 +31,12 @@ describe OpenXml::DrawingML::Elements::TailEnd do
|
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
|
|
32
|
-
for_attribute(:width
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
for_attribute(:width) do
|
|
35
|
+
%i(lg med sm).each do |allowed_value|
|
|
36
|
+
with_value(allowed_value) do
|
|
37
|
+
it_should_assign_successfully
|
|
38
|
+
it_should_output "<a:tailEnd w=\"#{allowed_value}\"/>"
|
|
39
|
+
end
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
with_value(:bad_value) do
|
|
@@ -5,55 +5,76 @@ describe OpenXml::DrawingML::Elements::TransformEffect do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :xfrm, name: "transform_effect"
|
|
7
7
|
|
|
8
|
-
for_attribute(:horizontal_skew
|
|
9
|
-
|
|
8
|
+
for_attribute(:horizontal_skew) do
|
|
9
|
+
with_value(1) do
|
|
10
10
|
it_should_assign_successfully
|
|
11
|
-
|
|
11
|
+
it_should_output "<a:xfrm kx=\"1\"/>"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
with_value(
|
|
14
|
+
with_value(-1) do
|
|
15
|
+
it_should_assign_successfully
|
|
16
|
+
it_should_output "<a:xfrm kx=\"-1\"/>"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
with_value([:not_a_number, 12.34]) do
|
|
15
20
|
it_should_raise_an_exception
|
|
16
21
|
end
|
|
17
22
|
end
|
|
18
23
|
|
|
19
|
-
for_attribute(:vertical_skew
|
|
20
|
-
|
|
24
|
+
for_attribute(:vertical_skew) do
|
|
25
|
+
with_value(1) do
|
|
21
26
|
it_should_assign_successfully
|
|
22
|
-
|
|
27
|
+
it_should_output "<a:xfrm ky=\"1\"/>"
|
|
23
28
|
end
|
|
24
29
|
|
|
25
|
-
with_value(
|
|
30
|
+
with_value(-1) do
|
|
31
|
+
it_should_assign_successfully
|
|
32
|
+
it_should_output "<a:xfrm ky=\"-1\"/>"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
with_value([:not_a_number, 12.34]) do
|
|
26
36
|
it_should_raise_an_exception
|
|
27
37
|
end
|
|
28
38
|
end
|
|
29
39
|
|
|
30
|
-
for_attribute(:horizontal_shift
|
|
31
|
-
|
|
40
|
+
for_attribute(:horizontal_shift) do
|
|
41
|
+
with_value(1) do
|
|
42
|
+
it_should_assign_successfully
|
|
43
|
+
it_should_output "<a:xfrm tx=\"1\"/>"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
with_value(-1) do
|
|
32
47
|
it_should_assign_successfully
|
|
33
|
-
|
|
48
|
+
it_should_output "<a:xfrm tx=\"-1\"/>"
|
|
34
49
|
end
|
|
35
50
|
|
|
36
|
-
with_value(:not_a_number) do
|
|
51
|
+
with_value([:not_a_number, 12.34]) do
|
|
37
52
|
it_should_raise_an_exception
|
|
38
53
|
end
|
|
39
54
|
end
|
|
40
55
|
|
|
41
|
-
for_attribute(:vertical_shift
|
|
42
|
-
|
|
56
|
+
for_attribute(:vertical_shift) do
|
|
57
|
+
with_value(1) do
|
|
43
58
|
it_should_assign_successfully
|
|
44
|
-
|
|
59
|
+
it_should_output "<a:xfrm ty=\"1\"/>"
|
|
45
60
|
end
|
|
46
61
|
|
|
47
|
-
with_value(
|
|
62
|
+
with_value(-1) do
|
|
63
|
+
it_should_assign_successfully
|
|
64
|
+
it_should_output "<a:xfrm ty=\"-1\"/>"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
with_value([:not_a_number, 12.34]) do
|
|
48
68
|
it_should_raise_an_exception
|
|
49
69
|
end
|
|
50
70
|
end
|
|
51
71
|
|
|
52
|
-
for_attribute(:horizontal_ratio
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
for_attribute(:horizontal_ratio) do
|
|
73
|
+
%w(1% -1% 1.1%).each do |allowed_value|
|
|
74
|
+
with_value(allowed_value) do
|
|
75
|
+
it_should_assign_successfully
|
|
76
|
+
it_should_output "<a:xfrm sx=\"#{allowed_value}\"/>"
|
|
77
|
+
end
|
|
57
78
|
end
|
|
58
79
|
|
|
59
80
|
with_values(["1", 1]) do
|
|
@@ -61,11 +82,12 @@ describe OpenXml::DrawingML::Elements::TransformEffect do
|
|
|
61
82
|
end
|
|
62
83
|
end
|
|
63
84
|
|
|
64
|
-
for_attribute(:vertical_ratio
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
85
|
+
for_attribute(:vertical_ratio) do
|
|
86
|
+
%w(1% -1% 1.1%).each do |allowed_value|
|
|
87
|
+
with_value(allowed_value) do
|
|
88
|
+
it_should_assign_successfully
|
|
89
|
+
it_should_output "<a:xfrm sy=\"#{allowed_value}\"/>"
|
|
90
|
+
end
|
|
69
91
|
end
|
|
70
92
|
|
|
71
93
|
with_values(["1", 1]) do
|
|
@@ -9,10 +9,10 @@ describe OpenXml::Docx::Elements::MarkupCompatibilityChoice do
|
|
|
9
9
|
it_should_output "<mc:Choice/>", assign: false
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
for_attribute(:
|
|
12
|
+
for_attribute(:requires) do
|
|
13
13
|
with_value("wps") do
|
|
14
14
|
it_should_assign_successfully
|
|
15
|
-
|
|
15
|
+
it_should_output "<mc:Choice Requires=\"wps\"/>"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
with_value(1234) do
|
|
@@ -30,4 +30,29 @@ describe OpenXml::Docx::Elements::Paragraph do
|
|
|
30
30
|
it_should_output_correct_xml
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
context "with section properties" do
|
|
34
|
+
before(:each) do
|
|
35
|
+
@instance = described_class.new
|
|
36
|
+
ps = OpenXml::Docx::Properties::PageSize.new
|
|
37
|
+
ps.height = 15840
|
|
38
|
+
ps.width = 12240
|
|
39
|
+
@instance.section << ps
|
|
40
|
+
|
|
41
|
+
pm = OpenXml::Docx::Properties::PageMargins.new
|
|
42
|
+
pm.bottom = 1440
|
|
43
|
+
pm.footer = 720
|
|
44
|
+
pm.header = 720
|
|
45
|
+
pm.left = 1440
|
|
46
|
+
pm.right = 1440
|
|
47
|
+
pm.top = 1440
|
|
48
|
+
|
|
49
|
+
@instance.section << pm
|
|
50
|
+
columns = OpenXml::Docx::Properties::Columns.new
|
|
51
|
+
columns.space = 720
|
|
52
|
+
@instance.section << columns
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it_should_output_correct_xml node_xml: "paragraph_with_section_properties"
|
|
57
|
+
end
|
|
33
58
|
end
|
|
@@ -5,10 +5,10 @@ describe OpenXml::Docx::Elements::Symbol do
|
|
|
5
5
|
|
|
6
6
|
it_should_use tag: :sym, name: "symbol"
|
|
7
7
|
|
|
8
|
-
for_attribute(:font
|
|
8
|
+
for_attribute(:font) do
|
|
9
9
|
with_value("Wingdings") do
|
|
10
10
|
it_should_assign_successfully
|
|
11
|
-
|
|
11
|
+
it_should_output "<w:sym w:font=\"Wingdings\"/>"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
with_value(123) do
|
|
@@ -16,10 +16,10 @@ describe OpenXml::Docx::Elements::Symbol do
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
for_attribute(:character
|
|
19
|
+
for_attribute(:character) do
|
|
20
20
|
with_value("43FD") do
|
|
21
21
|
it_should_assign_successfully
|
|
22
|
-
|
|
22
|
+
it_should_output "<w:sym w:char=\"43FD\"/>"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
with_value("43gg") do
|