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
@@ -15,7 +15,6 @@ require "openxml/docx/properties/string_property"
|
|
15
15
|
require "openxml/docx/properties/on_off_property"
|
16
16
|
require "openxml/docx/properties/toggle_property"
|
17
17
|
require "openxml/docx/properties/string_property"
|
18
|
-
require "openxml/docx/properties/width_property"
|
19
18
|
require "openxml/docx/properties/container_property"
|
20
19
|
require "openxml/docx/properties/style"
|
21
20
|
Dir.glob("#{File.join(File.dirname(__FILE__), "properties", "*.rb")}").each do |file|
|
@@ -5,7 +5,7 @@ module OpenXml
|
|
5
5
|
tag :jc
|
6
6
|
|
7
7
|
def ok_values
|
8
|
-
|
8
|
+
%i(both center distribute end highKashida lowKashida mediumKashida numTab start thaiDistribute left right)
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
@@ -22,6 +22,11 @@ module OpenXml
|
|
22
22
|
@property_name = args.first if args.any?
|
23
23
|
@name
|
24
24
|
end
|
25
|
+
|
26
|
+
def namespace(*args)
|
27
|
+
@namespace = args.first if args.any?
|
28
|
+
@namespace
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
def initialize(tag=nil, *args)
|
@@ -52,6 +57,14 @@ module OpenXml
|
|
52
57
|
(class_name[0, 1].downcase + class_name[1..-1]).to_sym
|
53
58
|
end
|
54
59
|
|
60
|
+
def namespace
|
61
|
+
self.class.namespace || default_namespace
|
62
|
+
end
|
63
|
+
|
64
|
+
def default_namespace
|
65
|
+
:w
|
66
|
+
end
|
67
|
+
|
55
68
|
private
|
56
69
|
|
57
70
|
def class_name
|
@@ -4,15 +4,17 @@ module OpenXml
|
|
4
4
|
class Border < ComplexProperty
|
5
5
|
attr_reader :tag
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :color, expects: :hex_color
|
9
|
+
attribute :frame, expects: :true_or_false
|
10
|
+
attribute :shadow, expects: :true_or_false
|
11
|
+
attribute :size, expects: :positive_integer, displays_as: :sz
|
12
|
+
attribute :space, expects: :positive_integer
|
13
|
+
attribute :theme_color, expects: :valid_theme_color
|
14
|
+
attribute :theme_shade, expects: :hex_digit
|
15
|
+
attribute :theme_tint, expects: :hex_digit
|
16
|
+
attribute :type, expects: :valid_type, displays_as: :val
|
17
|
+
end
|
16
18
|
|
17
19
|
def initialize(tag=:bdr)
|
18
20
|
@tag = tag
|
@@ -2,10 +2,12 @@ module OpenXml
|
|
2
2
|
module Docx
|
3
3
|
module Properties
|
4
4
|
class Color < ComplexProperty
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
with_namespace :w do
|
6
|
+
attribute :color, expects: :hex_color, displays_as: :val
|
7
|
+
attribute :theme_color, expects: :valid_theme_color
|
8
|
+
attribute :theme_shade, expects: :hex_digit
|
9
|
+
attribute :theme_tint, expects: :hex_digit
|
10
|
+
end
|
9
11
|
|
10
12
|
end
|
11
13
|
end
|
@@ -4,8 +4,10 @@ module OpenXml
|
|
4
4
|
class Column < ComplexProperty
|
5
5
|
tag :col
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :space, expects: :positive_integer
|
9
|
+
attribute :width, expects: :positive_integer, displays_as: :w
|
10
|
+
end
|
9
11
|
|
10
12
|
def initialize(space, width)
|
11
13
|
self.space = space
|
@@ -7,10 +7,12 @@ module OpenXml
|
|
7
7
|
tag :cols
|
8
8
|
child_class :column
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
with_namespace :w do
|
11
|
+
attribute :equal_width, expects: :true_or_false
|
12
|
+
attribute :number, expects: :integer, displays_as: :num
|
13
|
+
attribute :separator, expects: :true_or_false, displays_as: :sep
|
14
|
+
attribute :space, expects: :integer
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -4,18 +4,20 @@ module OpenXml
|
|
4
4
|
class ConditionalFormatting < ComplexProperty
|
5
5
|
tag :cnfStyle
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :even_horizontal_band, expects: :true_or_false, displays_as: :evenHBand
|
9
|
+
attribute :even_vertical_band, expects: :true_or_false, displays_as: :evenVBand
|
10
|
+
attribute :first_column, expects: :true_or_false
|
11
|
+
attribute :first_row, expects: :true_or_false
|
12
|
+
attribute :first_row_first_column, expects: :true_or_false
|
13
|
+
attribute :first_row_last_column, expects: :true_or_false
|
14
|
+
attribute :last_column, expects: :true_or_false
|
15
|
+
attribute :last_row, expects: :true_or_false
|
16
|
+
attribute :last_row_first_column, expects: :true_or_false
|
17
|
+
attribute :last_row_last_column, expects: :true_or_false
|
18
|
+
attribute :odd_horizontal_band, expects: :true_or_false, displays_as: :oddHBand
|
19
|
+
attribute :odd_vertical_band, expects: :true_or_false, displays_as: :oddVBand
|
20
|
+
end
|
19
21
|
|
20
22
|
end
|
21
23
|
end
|
@@ -4,16 +4,10 @@ module OpenXml
|
|
4
4
|
class DocumentGrid < ComplexProperty
|
5
5
|
tag :docGrid
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
VALID_GRID_TYPES = %i(default lines linesAndChars snapToChars)
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def valid_grid_type(value)
|
16
|
-
valid_in? value, VALID_GRID_TYPES
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :char_space, expects: :integer
|
9
|
+
attribute :line_pitch, expects: :integer
|
10
|
+
attribute :type, one_of: %i(default lines linesAndChars snapToChars)
|
17
11
|
end
|
18
12
|
|
19
13
|
end
|
@@ -2,18 +2,13 @@ module OpenXml
|
|
2
2
|
module Docx
|
3
3
|
module Properties
|
4
4
|
class EastAsianLayout < ComplexProperty
|
5
|
-
attribute :combine, expects: :on_or_off
|
6
|
-
attribute :combine_brackets, expects: :valid_bracket
|
7
|
-
attribute :id, expects: :integer
|
8
|
-
attribute :vertical, expects: :on_or_off, displays_as: :vert
|
9
|
-
attribute :vertical_compress, expects: :on_or_off, displays_as: :vertCompress
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
with_namespace :w do
|
7
|
+
attribute :combine, expects: :on_or_off
|
8
|
+
attribute :combine_brackets, one_of: %i(angle curly none round square)
|
9
|
+
attribute :id, expects: :integer
|
10
|
+
attribute :vertical, expects: :on_or_off, displays_as: :vert
|
11
|
+
attribute :vertical_compress, expects: :on_or_off, displays_as: :vertCompress
|
17
12
|
end
|
18
13
|
|
19
14
|
end
|
@@ -4,28 +4,24 @@ module OpenXml
|
|
4
4
|
class Font < ComplexProperty
|
5
5
|
tag :rFonts
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def valid_hint(value)
|
28
|
-
valid_in? value, VALID_HINTS
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :ascii, expects: :string
|
9
|
+
attribute :ascii_theme, one_of: %i(majorAscii majorBidi majorEastAsia
|
10
|
+
majorHAnsi minorAscii minorBidi
|
11
|
+
minorEastAsia minorHAnsi)
|
12
|
+
attribute :complex, expects: :string, displays_as: :cs
|
13
|
+
attribute :complex_theme, displays_as: :cstheme, one_of: %i(majorAscii majorBidi majorEastAsia
|
14
|
+
majorHAnsi minorAscii minorBidi
|
15
|
+
minorEastAsia minorHAnsi)
|
16
|
+
attribute :east_asia, expects: :string
|
17
|
+
attribute :east_asia_theme, one_of: %i(majorAscii majorBidi majorEastAsia
|
18
|
+
majorHAnsi minorAscii minorBidi
|
19
|
+
minorEastAsia minorHAnsi)
|
20
|
+
attribute :high_ansi, expects: :string, displays_as: :hAnsi
|
21
|
+
attribute :high_ansi_theme, displays_as: :hAnsiTheme, one_of: %i(majorAscii majorBidi majorEastAsia
|
22
|
+
majorHAnsi minorAscii minorBidi
|
23
|
+
minorEastAsia minorHAnsi)
|
24
|
+
attribute :hint, one_of: %i(cs default eastAsia)
|
29
25
|
end
|
30
26
|
|
31
27
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Docx
|
3
|
+
module Properties
|
4
|
+
class FooterReference < ComplexProperty
|
5
|
+
namespace :w
|
6
|
+
|
7
|
+
attribute :id, expects: :string, namespace: :r
|
8
|
+
attribute :type, expects: :valid_footer_type, namespace: :w
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def valid_footer_type(value)
|
13
|
+
ok_values = %i(default even first)
|
14
|
+
message = "Invalid footer type (#{value}). Allowed types are: #{ok_values.join(", ")}."
|
15
|
+
raise ArgumentError, message unless ok_values.include? value
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -4,53 +4,22 @@ module OpenXml
|
|
4
4
|
class Frame < ComplexProperty
|
5
5
|
tag :framePr
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
VALID_ANCHORS = %i(margin page text)
|
24
|
-
VALID_DROP_CAPS = %i(drop margin none)
|
25
|
-
VALID_HEIGHT_RULES = %i(atLeast auto exact)
|
26
|
-
VALID_RELATIVE_HORIZONTAL_POSITIONS = %i(center inside left outside right)
|
27
|
-
VALID_RELATIVE_VERTICAL_POSITIONS = %i(bottom center inline inside outside top)
|
28
|
-
VALID_WRAPS = %i(around auto none notBeside through tight)
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def valid_drop_cap(value)
|
33
|
-
valid_in? value, VALID_DROP_CAPS
|
34
|
-
end
|
35
|
-
|
36
|
-
def valid_anchor(value)
|
37
|
-
valid_in? value, VALID_ANCHORS
|
38
|
-
end
|
39
|
-
|
40
|
-
def valid_height_rule(value)
|
41
|
-
valid_in? value, VALID_HEIGHT_RULES
|
42
|
-
end
|
43
|
-
|
44
|
-
def valid_relative_horizontal_position(value)
|
45
|
-
valid_in? value, VALID_RELATIVE_HORIZONTAL_POSITIONS
|
46
|
-
end
|
47
|
-
|
48
|
-
def valid_relative_vertical_position(value)
|
49
|
-
valid_in? value, VALID_RELATIVE_VERTICAL_POSITIONS
|
50
|
-
end
|
51
|
-
|
52
|
-
def valid_wrap(value)
|
53
|
-
valid_in? value, VALID_WRAPS
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :anchor_lock, expects: :true_or_false
|
9
|
+
attribute :drop_cap, one_of: %i(drop margin none)
|
10
|
+
attribute :height, expects: :positive_integer, displays_as: :h
|
11
|
+
attribute :height_rule, one_of: %i(atLeast auto exact), displays_as: :hRule
|
12
|
+
attribute :horizontal_anchor, one_of: %i(margin page text), displays_as: :hAnchor
|
13
|
+
attribute :horizontal_padding, expects: :positive_integer, displays_as: :hSpace
|
14
|
+
attribute :horizontal_position, expects: :integer, displays_as: :x
|
15
|
+
attribute :lines, expects: :positive_integer
|
16
|
+
attribute :relative_horizontal_position, one_of: %i(center inside left outside right), displays_as: :xAlign
|
17
|
+
attribute :relative_vertical_position, one_of: %i(bottom center inline inside outside top), displays_as: :yAlign
|
18
|
+
attribute :vertical_anchor, one_of: %i(margin page text), displays_as: :vAnchor
|
19
|
+
attribute :vertical_padding, expects: :positive_integer, displays_as: :vSpace
|
20
|
+
attribute :vertical_position, expects: :integer, displays_as: :y
|
21
|
+
attribute :width, expects: :positive_integer, displays_as: :w
|
22
|
+
attribute :wrap, one_of: %i(around auto none notBeside through tight)
|
54
23
|
end
|
55
24
|
|
56
25
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Docx
|
3
|
+
module Properties
|
4
|
+
class HeaderReference < ComplexProperty
|
5
|
+
namespace :w
|
6
|
+
|
7
|
+
attribute :id, expects: :string, namespace: :r
|
8
|
+
attribute :type, expects: :valid_header_type, namespace: :w
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def valid_header_type(value)
|
13
|
+
ok_values = %i(default even first)
|
14
|
+
message = "Invalid header type (#{value}). Allowed types are: #{ok_values.join(", ")}."
|
15
|
+
raise ArgumentError, message unless ok_values.include? value
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -4,14 +4,17 @@ module OpenXml
|
|
4
4
|
class Indentation < ComplexProperty
|
5
5
|
tag :ind
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :end, expects: :integer
|
9
|
+
attribute :end_characters, expects: :integer, displays_as: :endChars
|
10
|
+
attribute :hanging, expects: :integer
|
11
|
+
attribute :hanging_characters, expects: :integer, displays_as: :hangingChars
|
12
|
+
attribute :first_line, expects: :integer
|
13
|
+
attribute :first_line_characters, expects: :integer, displays_as: :firstLineChars
|
14
|
+
attribute :start, expects: :integer
|
15
|
+
attribute :start_characters, expects: :integer, displays_as: :startChars
|
16
|
+
end
|
17
|
+
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
@@ -4,9 +4,11 @@ module OpenXml
|
|
4
4
|
class Language < ComplexProperty
|
5
5
|
tag :lang
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
with_namespace :w do
|
8
|
+
attribute :bidi, expects: :valid_language
|
9
|
+
attribute :east_asia, expects: :valid_language
|
10
|
+
attribute :latin, expects: :valid_language, displays_as: :val
|
11
|
+
end
|
10
12
|
|
11
13
|
private
|
12
14
|
|
@@ -6,12 +6,15 @@ module OpenXml
|
|
6
6
|
class LatentStyles < ContainerProperty
|
7
7
|
child_class :latent_styles_exception
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
with_namespace :w do
|
10
|
+
attribute :count, expects: :positive_integer
|
11
|
+
attribute :default_locked_state, expects: :true_or_false, displays_as: :defLockedState
|
12
|
+
attribute :default_qformat, expects: :true_or_false, displays_as: :defQFormat
|
13
|
+
attribute :default_semi_hidden, expects: :true_or_false, displays_as: :defSemiHidden
|
14
|
+
attribute :default_ui_priority, expects: :integer, displays_as: :defUIPriority
|
15
|
+
attribute :default_unhide_when_used, expects: :true_or_false, displays_as: :defUnhideWhenUsed
|
16
|
+
end
|
17
|
+
|
15
18
|
|
16
19
|
def render?
|
17
20
|
true # Output XML even if there are no children
|