ooxml_parser 0.8.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +55 -48
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/number_string_cache.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +6 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +4 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +0 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/color.rb +6 -6
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +0 -33
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +8 -1
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +2 -4
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +1 -5
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +1 -7
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +1 -1
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +4 -4
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +38 -21
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +5 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +2 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +1 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +1 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +2 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +2 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +1 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +2 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +1 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +1 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +1 -1
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +17 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +6 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb +114 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/alignment.rb +5 -5
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +1 -1
- metadata +110 -35
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +0 -28
@@ -180,7 +180,7 @@ module OoxmlParser
|
|
180
180
|
case element.name
|
181
181
|
when 'p'
|
182
182
|
child = element.child
|
183
|
-
unless child.nil? && doc_structure.elements.last.
|
183
|
+
unless child.nil? && doc_structure.elements.last.instance_of?(Table)
|
184
184
|
paragraph_style = DocumentStructure.default_paragraph_style.dup.parse(element, number, DocumentStructure.default_run_style, parent: doc_structure)
|
185
185
|
number += 1
|
186
186
|
doc_structure.elements << paragraph_style.dup
|
@@ -217,7 +217,7 @@ module OoxmlParser
|
|
217
217
|
# Parse default style
|
218
218
|
# @return [void]
|
219
219
|
def parse_default_style
|
220
|
-
doc = parse_xml(OOXMLDocumentObject.path_to_folder
|
220
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
221
221
|
doc.search('//w:style').each do |style|
|
222
222
|
next if style.attribute('default').nil?
|
223
223
|
|
@@ -9,8 +9,8 @@ module OoxmlParser
|
|
9
9
|
|
10
10
|
def initialize(params = {})
|
11
11
|
@comments_array = []
|
12
|
-
@
|
13
|
-
|
12
|
+
@file = params.fetch(:file, "#{OOXMLDocumentObject.path_to_folder}word/comments.xml")
|
13
|
+
super(parent: params[:parent])
|
14
14
|
end
|
15
15
|
|
16
16
|
# @return [Comment] accessor
|
@@ -6,7 +6,7 @@ module OoxmlParser
|
|
6
6
|
class CommentsExtended < OOXMLDocumentObject
|
7
7
|
def initialize(parent: nil)
|
8
8
|
@comments_extended_array = []
|
9
|
-
|
9
|
+
super
|
10
10
|
end
|
11
11
|
|
12
12
|
# @return [Array, CommentsExtended] accessor
|
@@ -17,7 +17,7 @@ module OoxmlParser
|
|
17
17
|
# Parse CommentsExtended object
|
18
18
|
# @return [CommentsExtended] result of parsing
|
19
19
|
def parse
|
20
|
-
file_to_parse = OOXMLDocumentObject.path_to_folder
|
20
|
+
file_to_parse = "#{OOXMLDocumentObject.path_to_folder}word/commentsExtended.xml"
|
21
21
|
return nil unless File.exist?(file_to_parse)
|
22
22
|
|
23
23
|
doc = parse_xml(file_to_parse)
|
@@ -9,7 +9,7 @@ module OoxmlParser
|
|
9
9
|
# Parse Settings object
|
10
10
|
# @return [DocumentSettings] result of parsing
|
11
11
|
def parse
|
12
|
-
settings_path = OOXMLDocumentObject.path_to_folder
|
12
|
+
settings_path = "#{OOXMLDocumentObject.path_to_folder}word/settings.xml"
|
13
13
|
return nil unless File.exist?(settings_path)
|
14
14
|
|
15
15
|
doc = parse_xml(settings_path)
|
@@ -41,7 +41,7 @@ module OoxmlParser
|
|
41
41
|
@number = 0
|
42
42
|
@bookmark_start = []
|
43
43
|
@bookmark_end = []
|
44
|
-
@align =
|
44
|
+
@align = :left
|
45
45
|
@spacing = Spacing.new
|
46
46
|
@ind = Indents.new
|
47
47
|
@character_style_array = []
|
@@ -52,7 +52,7 @@ module OoxmlParser
|
|
52
52
|
@page_numbering = false
|
53
53
|
@keep_next = false
|
54
54
|
@orphan_control = true
|
55
|
-
|
55
|
+
super
|
56
56
|
end
|
57
57
|
|
58
58
|
alias elements character_style_array
|
@@ -177,7 +177,7 @@ module OoxmlParser
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
@number = par_number
|
180
|
-
character_styles_array.last.text = character_styles_array.last.text.rstrip if character_styles_array.last.
|
180
|
+
character_styles_array.last.text = character_styles_array.last.text.rstrip if character_styles_array.last.instance_of?(DocxParagraphRun)
|
181
181
|
@character_style_array = character_styles_array
|
182
182
|
@parent = parent
|
183
183
|
self
|
@@ -247,7 +247,7 @@ module OoxmlParser
|
|
247
247
|
# @param character_style [DocxParagraphRun] style to parse
|
248
248
|
# @return [void]
|
249
249
|
def parse_paragraph_style_xml(id, character_style)
|
250
|
-
doc = parse_xml(OOXMLDocumentObject.path_to_folder
|
250
|
+
doc = parse_xml("#{OOXMLDocumentObject.path_to_folder}word/styles.xml")
|
251
251
|
doc.search('//w:style').each do |style|
|
252
252
|
next unless style.attribute('styleId').value == id
|
253
253
|
|
@@ -51,33 +51,14 @@ module OoxmlParser
|
|
51
51
|
when 'smallCaps'
|
52
52
|
self.caps = :small_caps if option_enabled?(node_child)
|
53
53
|
when 'color'
|
54
|
-
node_child
|
55
|
-
case key
|
56
|
-
when 'val'
|
57
|
-
self.font_color = Color.new(parent: self).parse_hex_string(value.value)
|
58
|
-
when 'themeColor'
|
59
|
-
if root_object.theme && root_object.theme.color_scheme[value.value.to_sym]
|
60
|
-
break if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works
|
61
|
-
|
62
|
-
self.font_color = root_object.theme.color_scheme[value.value.to_sym].color.dup
|
63
|
-
end
|
64
|
-
when 'themeShade'
|
65
|
-
font_color.calculate_with_shade!(value.value.hex.to_f / 255.0)
|
66
|
-
when 'themeTint'
|
67
|
-
font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0))
|
68
|
-
end
|
69
|
-
end
|
54
|
+
parse_color_tag(node_child)
|
70
55
|
when 'shd'
|
71
56
|
self.background_color = node_child.attribute('fill').value
|
72
57
|
unless node_child.attribute('fill').value == 'auto' || node_child.attribute('fill').value == '' || node_child.attribute('fill').value == 'null'
|
73
58
|
self.background_color = Color.new(parent: self).parse_hex_string(node_child.attribute('fill').value)
|
74
59
|
end
|
75
60
|
when 'u', 'uCs'
|
76
|
-
|
77
|
-
if option_enabled?(node_child)
|
78
|
-
font_style.underlined.style = node_child.attribute('val').value
|
79
|
-
font_style.underlined.color = Color.new(parent: font_style.underlined).parse_hex_string(node_child.attribute('color').value) unless node_child.attribute('color').nil?
|
80
|
-
end
|
61
|
+
parse_underline(node_child)
|
81
62
|
when 'strike'
|
82
63
|
font_style.strike = :single if option_enabled?(node_child)
|
83
64
|
when 'dstrike'
|
@@ -86,5 +67,41 @@ module OoxmlParser
|
|
86
67
|
end
|
87
68
|
self
|
88
69
|
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
# Parse `color` tag
|
74
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
75
|
+
# @return [nil]
|
76
|
+
def parse_color_tag(node)
|
77
|
+
node.attributes.each do |key, value|
|
78
|
+
case key
|
79
|
+
when 'val'
|
80
|
+
self.font_color = Color.new(parent: self).parse_hex_string(value.value)
|
81
|
+
when 'themeColor'
|
82
|
+
if root_object.theme && root_object.theme.color_scheme[value.value.to_sym]
|
83
|
+
break if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works
|
84
|
+
|
85
|
+
self.font_color = root_object.theme.color_scheme[value.value.to_sym].color.dup
|
86
|
+
end
|
87
|
+
when 'themeShade'
|
88
|
+
font_color.calculate_with_shade!(value.value.hex.to_f / 255.0)
|
89
|
+
when 'themeTint'
|
90
|
+
font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0))
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Parse `u` or `uCs` tag
|
96
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
97
|
+
# @return [nil]
|
98
|
+
def parse_underline(node)
|
99
|
+
font_style.underlined = Underline.new
|
100
|
+
|
101
|
+
return unless option_enabled?(node)
|
102
|
+
|
103
|
+
font_style.underlined.style = node.attribute('val').value
|
104
|
+
font_style.underlined.color = Color.new(parent: font_style.underlined).parse_hex_string(node.attribute('color').value) unless node.attribute('color').nil?
|
105
|
+
end
|
89
106
|
end
|
90
107
|
end
|
@@ -13,7 +13,7 @@ module OoxmlParser
|
|
13
13
|
@type = type
|
14
14
|
@properties = properties
|
15
15
|
@elements = elements
|
16
|
-
|
16
|
+
super(parent: parent)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Parse Shape object
|
@@ -70,7 +70,7 @@ module OoxmlParser
|
|
70
70
|
def value_to_hex(value)
|
71
71
|
value.to_s
|
72
72
|
.sub('#', '')
|
73
|
-
.split
|
73
|
+
.split
|
74
74
|
.first
|
75
75
|
end
|
76
76
|
end
|
data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb
CHANGED
@@ -5,14 +5,11 @@ module OoxmlParser
|
|
5
5
|
class StyleParametres < OOXMLDocumentObject
|
6
6
|
attr_accessor :q_format, :hidden, :name
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@q_format = q_format
|
14
|
-
@hidden = hidden
|
15
|
-
@parent = parent
|
8
|
+
def initialize(params = {})
|
9
|
+
@name = params[:name]
|
10
|
+
@q_format = params.fetch(:q_format, false)
|
11
|
+
@hidden = params.fetch(:hidden, false)
|
12
|
+
super(parent: params[:parent])
|
16
13
|
end
|
17
14
|
|
18
15
|
# Parse StyleParametres data
|