ooxml_parser 0.20.0 → 0.23.0
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.
- checksums.yaml +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/{effect_reference.rb → style_matrix_reference.rb} +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +4 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +14 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +30 -21
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +15 -23
- data/lib/ooxml_parser/common_parser/parser/encryption_checker.rb +43 -0
- data/lib/ooxml_parser/common_parser/parser.rb +5 -2
- data/lib/ooxml_parser/version.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/sheet.rb +39 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/protection.rb +32 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +5 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_protection.rb +38 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/protected_range.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_protection.rb +117 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +1 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/selection.rb +30 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +20 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/client_data.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +5 -0
- 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.rb +13 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +18 -1
- metadata +16 -10
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +0 -31
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a21fe67d2c235a37ec324fcd56428e39ff519f9a4f36b7c8257770b135922eec
|
4
|
+
data.tar.gz: c6ce18f4dd16cfc0d484ad0391b8787dbe7ba226b4fd744b5c44d7d4ac2e9f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d926a20fbd8fd1e855983994f0b7e707c3d5d603247fc3b3c4bcd8e680febb19b4cf3232bc68dd3f4c55852bb342d195a62f9af875ab6ad1a69a9f86668e38d8
|
7
|
+
data.tar.gz: 789f9064bbd3d17a21d6d01a9e39d8203a59f622cb2ce48e09de62dadec00e16e9ca9d38f5ebc56ff53920f7c00874077ce4d5358975844c25c14e494075c0d7
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module OoxmlParser
|
4
|
-
# Class for parsing `a:effectRef` tags
|
5
|
-
class
|
4
|
+
# Class for parsing `a:fillRef`, `a:effectRef`, `a:lnRef` tags
|
5
|
+
class StyleMatrixReference < OOXMLDocumentObject
|
6
6
|
# @return [Integer] Style Matrix Index
|
7
7
|
attr_reader :index
|
8
8
|
# @return [Color] scheme color of EffectReference
|
9
9
|
attr_reader :scheme_color
|
10
10
|
|
11
|
-
# Parse
|
11
|
+
# Parse StyleMatrixReference object
|
12
12
|
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
-
# @return [
|
13
|
+
# @return [StyleMatrixReference] result of parsing
|
14
14
|
def parse(node)
|
15
15
|
node.attributes.each do |key, value|
|
16
16
|
case key
|
@@ -1,9 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'shape_style/
|
4
|
-
require_relative 'shape_style/fill_reference'
|
3
|
+
require_relative 'shape_style/style_matrix_reference'
|
5
4
|
require_relative 'shape_style/font_reference'
|
6
|
-
require_relative 'shape_style/line_reference'
|
7
5
|
module OoxmlParser
|
8
6
|
# Class for parsing `wps:style` tags
|
9
7
|
class ShapeStyle < OOXMLDocumentObject
|
@@ -23,13 +21,13 @@ module OoxmlParser
|
|
23
21
|
node.xpath('*').each do |node_child|
|
24
22
|
case node_child.name
|
25
23
|
when 'effectRef'
|
26
|
-
@effect_reference =
|
24
|
+
@effect_reference = StyleMatrixReference.new(parent: self).parse(node_child)
|
27
25
|
when 'fillRef'
|
28
|
-
@fill_reference =
|
26
|
+
@fill_reference = StyleMatrixReference.new(parent: self).parse(node_child)
|
29
27
|
when 'fontRef'
|
30
28
|
@font_reference = FontReference.new(parent: self).parse(node_child)
|
31
29
|
when 'lnRef'
|
32
|
-
@line_reference =
|
30
|
+
@line_reference = StyleMatrixReference.new(parent: self).parse(node_child)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
self
|
@@ -10,9 +10,16 @@ module OoxmlParser
|
|
10
10
|
# Class for parsing `sp`, `wsp` tags
|
11
11
|
class DocxShape < OOXMLDocumentObject
|
12
12
|
attr_accessor :non_visual_properties, :properties, :style, :body_properties, :text_body
|
13
|
+
# @return [True, False] Specifies if text in shape is locked when sheet is protected
|
14
|
+
attr_reader :locks_text
|
13
15
|
|
14
16
|
alias shape_properties properties
|
15
17
|
|
18
|
+
def initialize(parent: nil)
|
19
|
+
@locks_text = true
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
16
23
|
# @return [True, false] if structure contain any user data
|
17
24
|
def with_data?
|
18
25
|
return true if @text_body.nil?
|
@@ -27,6 +34,13 @@ module OoxmlParser
|
|
27
34
|
# @param node [Nokogiri::XML:Element] node to parse
|
28
35
|
# @return [DocxShape] result of parsing
|
29
36
|
def parse(node)
|
37
|
+
node.attributes.each do |key, value|
|
38
|
+
case key
|
39
|
+
when 'fLocksText'
|
40
|
+
@locks_text = attribute_enabled?(value)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
30
44
|
node.xpath('*').each do |node_child|
|
31
45
|
case node_child.name
|
32
46
|
when 'nvSpPr'
|
@@ -12,23 +12,6 @@ module OoxmlParser
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class << self
|
15
|
-
# @param [String] string to parse
|
16
|
-
# @return [Coordinates]
|
17
|
-
def parse_coordinates_from_string(string)
|
18
|
-
coordinates = Coordinates.new
|
19
|
-
begin
|
20
|
-
coordinates.list = string.match(/'\w+'/)[0].delete("''")
|
21
|
-
rescue StandardError
|
22
|
-
'Raise Exception'
|
23
|
-
end
|
24
|
-
string = string.split('!').last
|
25
|
-
if coordinates?(string)
|
26
|
-
coordinates.row = string.scan(/[0-9]/).join.to_i
|
27
|
-
coordinates.column = string.scan(/[A-Z]/).join
|
28
|
-
end
|
29
|
-
coordinates
|
30
|
-
end
|
31
|
-
|
32
15
|
# Parse range of coordinates
|
33
16
|
# @param arguments_string [String] data to parse
|
34
17
|
# @return [Array] result
|
@@ -109,6 +92,18 @@ module OoxmlParser
|
|
109
92
|
end
|
110
93
|
end
|
111
94
|
|
95
|
+
# Parse string to coordinates
|
96
|
+
# @param [String] string to parse
|
97
|
+
# @return [Coordinates] result
|
98
|
+
def parse_string(string)
|
99
|
+
string = extract_list_from_string(string) if list_name_in_string?(string)
|
100
|
+
if Coordinates.coordinates?(string)
|
101
|
+
@row = string.scan(/\d/).join.to_i
|
102
|
+
@column = string.scan(/[A-Z]/).join
|
103
|
+
end
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
112
107
|
# @return [Integer] number of column
|
113
108
|
# This method takes @column string
|
114
109
|
# and converts into integer
|
@@ -118,10 +113,6 @@ module OoxmlParser
|
|
118
113
|
end
|
119
114
|
end
|
120
115
|
|
121
|
-
alias get_column_number column_number
|
122
|
-
extend Gem::Deprecate
|
123
|
-
deprecate :get_column_number, 'column_number', 2020, 1
|
124
|
-
|
125
116
|
# Compares rows of two cells
|
126
117
|
# @param [Coordinates] other_cell other cell coordinates
|
127
118
|
# @return [true, false] true, if row greater, than other row
|
@@ -151,5 +142,23 @@ module OoxmlParser
|
|
151
142
|
def ==(other)
|
152
143
|
other.is_a?(Coordinates) ? (@row == other.row && @column == other.column) : false
|
153
144
|
end
|
145
|
+
|
146
|
+
private
|
147
|
+
|
148
|
+
# Check if there is list name in string
|
149
|
+
# @param [String] string to check
|
150
|
+
# @return [Boolean] result
|
151
|
+
def list_name_in_string?(string)
|
152
|
+
string.include?('!')
|
153
|
+
end
|
154
|
+
|
155
|
+
# Extract list name and leave coordinates
|
156
|
+
# @param [String] string to parse
|
157
|
+
# @return [String] coordinates string without list
|
158
|
+
def extract_list_from_string(string)
|
159
|
+
split = string.split('!')
|
160
|
+
@list = split[0...-1].join('!')
|
161
|
+
split[-1]
|
162
|
+
end
|
154
163
|
end
|
155
164
|
end
|
@@ -43,14 +43,14 @@ module OoxmlParser
|
|
43
43
|
node.attributes.each do |key, value|
|
44
44
|
case key
|
45
45
|
when 'location'
|
46
|
-
@url = Coordinates.
|
46
|
+
@url = Coordinates.new.parse_string(value.value)
|
47
47
|
when 'id'
|
48
48
|
@id = value.value
|
49
49
|
@url = OOXMLDocumentObject.get_link_from_rels(@id) unless @id.empty?
|
50
50
|
when 'tooltip'
|
51
51
|
@tooltip = value.value
|
52
52
|
when 'ref'
|
53
|
-
@coordinates = Coordinates.
|
53
|
+
@coordinates = Coordinates.new.parse_string(value.value)
|
54
54
|
when 'action'
|
55
55
|
@action_link = value.value
|
56
56
|
when 'highlightClick'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'filemagic' unless Gem.win_platform?
|
4
3
|
require 'securerandom'
|
5
4
|
require 'nokogiri'
|
6
5
|
require 'zip'
|
6
|
+
require 'ooxml_decrypt'
|
7
7
|
require_relative 'ooxml_document_object/nokogiri_parsing_exception'
|
8
8
|
require_relative 'ooxml_document_object/ooxml_document_object_helper'
|
9
9
|
require_relative 'ooxml_document_object/ooxml_object_attribute_helper'
|
@@ -58,28 +58,6 @@ module OoxmlParser
|
|
58
58
|
# @return [String] path to root folder
|
59
59
|
attr_accessor :path_to_folder
|
60
60
|
|
61
|
-
# @param path_to_file [String] file
|
62
|
-
# @param ignore_system [True, False] should host system be ignored, since
|
63
|
-
# this method is OS-dependent
|
64
|
-
# @return [True, False] Check if file is protected by password on open
|
65
|
-
def encrypted_file?(path_to_file, ignore_system: false)
|
66
|
-
if Gem.win_platform? || ignore_system
|
67
|
-
warn 'FileMagic and checking file for encryption is not supported on Windows'
|
68
|
-
return false
|
69
|
-
end
|
70
|
-
file_result = FileMagic.new(:mime).file(path_to_file)
|
71
|
-
# Support of Encrtypted status in `file` util was introduced in file v5.20
|
72
|
-
# but LTS version of ubuntu before 16.04 uses older `file` and it return `Composite Document`
|
73
|
-
# https://github.com/file/file/blob/master/ChangeLog#L217
|
74
|
-
if file_result.include?('encrypted') ||
|
75
|
-
file_result.include?('Composite Document File V2 Document, No summary info') ||
|
76
|
-
file_result.include?('application/CDFV2-corrupt')
|
77
|
-
warn("File #{path_to_file} is encrypted. Can't parse it")
|
78
|
-
return true
|
79
|
-
end
|
80
|
-
false
|
81
|
-
end
|
82
|
-
|
83
61
|
# Copy this file and rename to zip
|
84
62
|
# @param path [String] path to file
|
85
63
|
# @return [String] path to result zip
|
@@ -95,6 +73,20 @@ module OoxmlParser
|
|
95
73
|
file_path
|
96
74
|
end
|
97
75
|
|
76
|
+
# Decrypt file protected with password
|
77
|
+
# @param path [String] path to file
|
78
|
+
# @param password [String] password to file
|
79
|
+
# @return [String] path to decrypted file
|
80
|
+
def decrypt_file(path, password)
|
81
|
+
file_name = File.basename(path)
|
82
|
+
tmp_folder = Dir.mktmpdir('ruby-ooxml-parser')
|
83
|
+
decrypted_path = "#{tmp_folder}/#{file_name}"
|
84
|
+
binary_password = password.encode('utf-16le').bytes.pack('c*').encode('binary')
|
85
|
+
OoxmlDecrypt::EncryptedFile.decrypt_to_file(path, binary_password, decrypted_path)
|
86
|
+
|
87
|
+
decrypted_path
|
88
|
+
end
|
89
|
+
|
98
90
|
# Unzip specified file
|
99
91
|
# @param path_to_file [String] path to zip file
|
100
92
|
# @param destination [String] folder to extract
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Check if file is encrypted
|
5
|
+
class EncryptionChecker
|
6
|
+
def initialize(file_path, ignore_system: false)
|
7
|
+
@file_path = file_path
|
8
|
+
@ignore_system = ignore_system
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Boolean] is file encrypted
|
12
|
+
def encrypted?
|
13
|
+
return false unless compatible_system?
|
14
|
+
|
15
|
+
# Support of Encrypted status in `file` util was introduced in file v5.20
|
16
|
+
# but LTS version of ubuntu before 16.04 uses older `file` and it return `Composite Document`
|
17
|
+
# https://github.com/file/file/blob/0eb7c1b83341cc954620b45d2e2d65ee7df1a4e7/ChangeLog#L623
|
18
|
+
if mime_type.include?('encrypted') ||
|
19
|
+
mime_type.include?('Composite Document File V2 Document, No summary info') ||
|
20
|
+
mime_type.include?('application/CDFV2-corrupt')
|
21
|
+
warn("File #{@file_path} is encrypted. Can't parse it")
|
22
|
+
return true
|
23
|
+
end
|
24
|
+
false
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Check if system is compatible with `file` utility
|
30
|
+
# @return [Boolean] Result of check
|
31
|
+
def compatible_system?
|
32
|
+
return true if !Gem.win_platform? && !@ignore_system
|
33
|
+
|
34
|
+
warn 'Checking file for encryption is not supported on Windows'
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String] mime type of file
|
39
|
+
def mime_type
|
40
|
+
@mime_type ||= `file -b --mime "#{@file_path}"`
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'parser/encryption_checker'
|
4
|
+
|
3
5
|
module OoxmlParser
|
4
6
|
# Basic class for OoxmlParser
|
5
7
|
class Parser
|
@@ -7,7 +9,7 @@ module OoxmlParser
|
|
7
9
|
# @param path_to_file [String] file
|
8
10
|
# @return [CommonDocumentStructure] structure of doc
|
9
11
|
def self.parse_format(path_to_file)
|
10
|
-
return nil if
|
12
|
+
return nil if EncryptionChecker.new(path_to_file).encrypted?
|
11
13
|
|
12
14
|
path_to_zip_file = OOXMLDocumentObject.copy_file_and_rename_to_zip(path_to_file)
|
13
15
|
OOXMLDocumentObject.path_to_folder = path_to_zip_file.sub(File.basename(path_to_zip_file), '')
|
@@ -21,7 +23,8 @@ module OoxmlParser
|
|
21
23
|
# Base method to parse document of any type
|
22
24
|
# @param path_to_file [String] file
|
23
25
|
# @return [CommonDocumentStructure] structure of doc
|
24
|
-
def self.parse(path_to_file)
|
26
|
+
def self.parse(path_to_file, password: nil)
|
27
|
+
path_to_file = OOXMLDocumentObject.decrypt_file(path_to_file, password) if password
|
25
28
|
Parser.parse_format(path_to_file) do
|
26
29
|
format = Parser.recognize_folder_format
|
27
30
|
case format
|
data/lib/ooxml_parser/version.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <sheet> tag
|
5
|
+
class Sheet < OOXMLDocumentObject
|
6
|
+
# @return [String] Name of sheet
|
7
|
+
attr_reader :name
|
8
|
+
# @return [Integer] SheetId of sheet
|
9
|
+
attr_reader :sheet_id
|
10
|
+
# @return [Symbol] Specifies if sheet is hidden
|
11
|
+
attr_reader :state
|
12
|
+
# @return [String] Id of sheet
|
13
|
+
attr_reader :id
|
14
|
+
|
15
|
+
def initialize(parent: nil)
|
16
|
+
@state = :visible
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
# Parse Sheet data
|
21
|
+
# @param [Nokogiri::XML:Element] node with Sheet data
|
22
|
+
# @return [Sheet] value of Sheet
|
23
|
+
def parse(node)
|
24
|
+
node.attributes.each do |key, value|
|
25
|
+
case key
|
26
|
+
when 'name'
|
27
|
+
@name = value.value.to_s
|
28
|
+
when 'sheetId'
|
29
|
+
@sheet_id = value.value.to_i
|
30
|
+
when 'state'
|
31
|
+
@state = value.value.to_sym
|
32
|
+
when 'id'
|
33
|
+
@id = value.value.to_s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
self
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <protection> tag
|
5
|
+
class Protection < OOXMLDocumentObject
|
6
|
+
# @return [True, False] Specifies if cell is locked
|
7
|
+
attr_reader :locked
|
8
|
+
# @return [True, False] Specifies if formulas in cell are hidden
|
9
|
+
attr_reader :hidden
|
10
|
+
|
11
|
+
def initialize(parent: nil)
|
12
|
+
@locked = true
|
13
|
+
@hidden = false
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
# Parse Protection data
|
18
|
+
# @param [Nokogiri::XML:Element] node with Protection data
|
19
|
+
# @return [Sheet] value of Protection
|
20
|
+
def parse(node)
|
21
|
+
node.attributes.each do |key, value|
|
22
|
+
case key
|
23
|
+
when 'locked'
|
24
|
+
@locked = attribute_enabled?(value)
|
25
|
+
when 'hidden'
|
26
|
+
@hidden = attribute_enabled?(value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'cell_style/alignment'
|
4
|
+
require_relative 'cell_style/protection'
|
4
5
|
module OoxmlParser
|
5
6
|
# Class for parsing `xf` object
|
6
7
|
class Xf < OOXMLDocumentObject
|
@@ -76,6 +77,8 @@ module OoxmlParser
|
|
76
77
|
attr_reader :fill_id
|
77
78
|
# @return [Integer] id of number format
|
78
79
|
attr_reader :number_format_id
|
80
|
+
# @return [Protection] Settings of cell protection
|
81
|
+
attr_reader :protection
|
79
82
|
|
80
83
|
def initialize(parent: nil)
|
81
84
|
@numerical_format = 'General'
|
@@ -115,6 +118,8 @@ module OoxmlParser
|
|
115
118
|
case node_child.name
|
116
119
|
when 'alignment'
|
117
120
|
@alignment.parse(node_child) if @apply_alignment
|
121
|
+
when 'protection'
|
122
|
+
@protection = Protection.new(parent: self).parse(node_child)
|
118
123
|
end
|
119
124
|
end
|
120
125
|
self
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <workbookProtection> tag
|
5
|
+
class WorkbookProtection < OOXMLDocumentObject
|
6
|
+
# @return [True, False] Specifies if workbook structure is protected
|
7
|
+
attr_reader :lock_structure
|
8
|
+
# @return [String] name of hashing algorithm
|
9
|
+
attr_reader :workbook_algorithm_name
|
10
|
+
# @return [String] hash value for the password
|
11
|
+
attr_reader :workbook_hash_value
|
12
|
+
# @return [String] salt value for the password
|
13
|
+
attr_reader :workbook_salt_value
|
14
|
+
# @return [Integer] number of times the hashing function shall be iteratively run
|
15
|
+
attr_reader :workbook_spin_count
|
16
|
+
|
17
|
+
# Parse WorkbookProtection data
|
18
|
+
# @param [Nokogiri::XML:Element] node with WorkbookProtection data
|
19
|
+
# @return [Sheet] value of WorkbookProtection
|
20
|
+
def parse(node)
|
21
|
+
node.attributes.each do |key, value|
|
22
|
+
case key
|
23
|
+
when 'lockStructure'
|
24
|
+
@lock_structure = attribute_enabled?(value)
|
25
|
+
when 'workbookAlgorithmName'
|
26
|
+
@workbook_algorithm_name = value.value.to_s
|
27
|
+
when 'workbookHashValue'
|
28
|
+
@workbook_hash_value = value.value.to_s
|
29
|
+
when 'workbookSaltValue'
|
30
|
+
@workbook_salt_value = value.value.to_s
|
31
|
+
when 'workbookSpinCount'
|
32
|
+
@workbook_spin_count = value.value.to_i
|
33
|
+
end
|
34
|
+
end
|
35
|
+
self
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <protectedRange> tag
|
5
|
+
class ProtectedRange < OOXMLDocumentObject
|
6
|
+
# @return [String] Name of hashing algorithm
|
7
|
+
attr_reader :algorithm_name
|
8
|
+
# @return [String] Hash value for the password
|
9
|
+
attr_reader :hash_value
|
10
|
+
# @return [String] Salt value for the password
|
11
|
+
attr_reader :salt_value
|
12
|
+
# @return [Integer] Number of times the hashing function shall be iteratively run
|
13
|
+
attr_reader :spin_count
|
14
|
+
# @return [String] Name of protected range
|
15
|
+
attr_accessor :name
|
16
|
+
# @return [String] Range reference
|
17
|
+
attr_reader :reference_sequence
|
18
|
+
|
19
|
+
# Parse ProtectedRange data
|
20
|
+
# @param [Nokogiri::XML:Element] node with ProtectedRange data
|
21
|
+
# @return [Sheet] value of ProtectedRange
|
22
|
+
def parse(node)
|
23
|
+
node.attributes.each do |key, value|
|
24
|
+
case key
|
25
|
+
when 'algorithmName'
|
26
|
+
@algorithm_name = value.value.to_s
|
27
|
+
when 'hashValue'
|
28
|
+
@hash_value = value.value.to_s
|
29
|
+
when 'saltValue'
|
30
|
+
@salt_value = value.value.to_s
|
31
|
+
when 'spinCount'
|
32
|
+
@spin_count = value.value.to_i
|
33
|
+
when 'name'
|
34
|
+
@name = value.value.to_s
|
35
|
+
when 'sqref'
|
36
|
+
@reference_sequence = value.value.to_s
|
37
|
+
end
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <sheetProtection> tag
|
5
|
+
class SheetProtection < OOXMLDocumentObject
|
6
|
+
# @return [String] Name of hashing algorithm
|
7
|
+
attr_reader :algorithm_name
|
8
|
+
# @return [String] Hash value for the password
|
9
|
+
attr_reader :hash_value
|
10
|
+
# @return [String] Salt value for the password
|
11
|
+
attr_reader :salt_value
|
12
|
+
# @return [Integer] Number of times the hashing function shall be iteratively run
|
13
|
+
attr_reader :spin_count
|
14
|
+
# @return [True, False] Specifies if sheet is protected
|
15
|
+
attr_reader :sheet
|
16
|
+
# @return [True, False] Specifies if using autofilter is not allowed on protected sheet
|
17
|
+
attr_reader :auto_filter
|
18
|
+
# @return [True, False] Specifies if deleting columns is not allowed on protected sheet
|
19
|
+
attr_reader :delete_columns
|
20
|
+
# @return [True, False] Specifies if deleting rows is not allowed on protected sheet
|
21
|
+
attr_reader :delete_rows
|
22
|
+
# @return [True, False] Specifies if formatting cells is not allowed on protected sheet
|
23
|
+
attr_reader :format_cells
|
24
|
+
# @return [True, False] Specifies if formatting columns is not allowed on protected sheet
|
25
|
+
attr_reader :format_columns
|
26
|
+
# @return [True, False] Specifies if formatting rows is not allowed on protected sheet
|
27
|
+
attr_reader :format_rows
|
28
|
+
# @return [True, False] Specifies if inserting columns is not allowed on protected sheet
|
29
|
+
attr_reader :insert_columns
|
30
|
+
# @return [True, False] Specifies if inserting rows is not allowed on protected sheet
|
31
|
+
attr_reader :insert_rows
|
32
|
+
# @return [True, False] Specifies if inserting hyperlinks is not allowed on protected sheet
|
33
|
+
attr_reader :insert_hyperlinks
|
34
|
+
# @return [True, False] Specifies if editing objects is not allowed on protected sheet
|
35
|
+
attr_reader :objects
|
36
|
+
# @return [True, False] Specifies if using pivot tables is not allowed on protected sheet
|
37
|
+
attr_reader :pivot_tables
|
38
|
+
# @return [True, False] Specifies if editing scenarios is not allowed on protected sheet
|
39
|
+
attr_reader :scenarios
|
40
|
+
# @return [True, False] Specifies if selecting locked cells is not allowed on protected sheet
|
41
|
+
attr_reader :select_locked_cells
|
42
|
+
# @return [True, False] Specifies if selecting unlocked cells is not allowed on protected sheet
|
43
|
+
attr_reader :select_unlocked_cells
|
44
|
+
# @return [True, False] Specifies if sorting is not allowed on protected sheet
|
45
|
+
attr_reader :sort
|
46
|
+
|
47
|
+
def initialize(parent: nil)
|
48
|
+
@objects = false
|
49
|
+
@scenarios = false
|
50
|
+
@select_locked_cells = false
|
51
|
+
@select_unlocked_cells = false
|
52
|
+
@auto_filter = true
|
53
|
+
@delete_columns = true
|
54
|
+
@delete_rows = true
|
55
|
+
@format_cells = true
|
56
|
+
@format_columns = true
|
57
|
+
@format_rows = true
|
58
|
+
@insert_columns = true
|
59
|
+
@insert_rows = true
|
60
|
+
@insert_hyperlinks = true
|
61
|
+
@pivot_tables = true
|
62
|
+
@sort = true
|
63
|
+
super
|
64
|
+
end
|
65
|
+
|
66
|
+
# Parse SheetProtection data
|
67
|
+
# @param [Nokogiri::XML:Element] node with SheetProtection data
|
68
|
+
# @return [Sheet] value of SheetProtection
|
69
|
+
def parse(node)
|
70
|
+
node.attributes.each do |key, value|
|
71
|
+
case key
|
72
|
+
when 'algorithmName'
|
73
|
+
@algorithm_name = value.value.to_s
|
74
|
+
when 'hashValue'
|
75
|
+
@hash_value = value.value.to_s
|
76
|
+
when 'saltValue'
|
77
|
+
@salt_value = value.value.to_s
|
78
|
+
when 'spinCount'
|
79
|
+
@spin_count = value.value.to_i
|
80
|
+
when 'sheet'
|
81
|
+
@sheet = attribute_enabled?(value)
|
82
|
+
when 'autoFilter'
|
83
|
+
@auto_filter = attribute_enabled?(value)
|
84
|
+
when 'deleteColumns'
|
85
|
+
@delete_columns = attribute_enabled?(value)
|
86
|
+
when 'deleteRows'
|
87
|
+
@delete_rows = attribute_enabled?(value)
|
88
|
+
when 'formatCells'
|
89
|
+
@format_cells = attribute_enabled?(value)
|
90
|
+
when 'formatColumns'
|
91
|
+
@format_columns = attribute_enabled?(value)
|
92
|
+
when 'formatRows'
|
93
|
+
@format_rows = attribute_enabled?(value)
|
94
|
+
when 'insertColumns'
|
95
|
+
@insert_columns = attribute_enabled?(value)
|
96
|
+
when 'insertRows'
|
97
|
+
@insert_rows = attribute_enabled?(value)
|
98
|
+
when 'insertHyperlinks'
|
99
|
+
@insert_hyperlinks = attribute_enabled?(value)
|
100
|
+
when 'objects'
|
101
|
+
@objects = attribute_enabled?(value)
|
102
|
+
when 'pivotTables'
|
103
|
+
@pivot_tables = attribute_enabled?(value)
|
104
|
+
when 'scenarios'
|
105
|
+
@scenarios = attribute_enabled?(value)
|
106
|
+
when 'selectLockedCells'
|
107
|
+
@select_locked_cells = attribute_enabled?(value)
|
108
|
+
when 'selectUnlockedCells'
|
109
|
+
@select_unlocked_cells = attribute_enabled?(value)
|
110
|
+
when 'sort'
|
111
|
+
@sort = attribute_enabled?(value)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
self
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb
CHANGED
@@ -14,7 +14,7 @@ module OoxmlParser
|
|
14
14
|
when 'state'
|
15
15
|
@state = value.value.to_sym
|
16
16
|
when 'topLeftCell'
|
17
|
-
@top_left_cell = Coordinates.
|
17
|
+
@top_left_cell = Coordinates.new.parse_string(value.value)
|
18
18
|
when 'xSplit'
|
19
19
|
@x_split = value.value
|
20
20
|
when 'ySplit'
|
data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/selection.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for `selection` data
|
5
|
+
class Selection < OOXMLDocumentObject
|
6
|
+
# @return [Coordinates] Reference to the active cell
|
7
|
+
attr_reader :active_cell
|
8
|
+
# @return [Integer] Id of active cell
|
9
|
+
attr_reader :active_cell_id
|
10
|
+
# @return [String] Selected range
|
11
|
+
attr_reader :reference_sequence
|
12
|
+
|
13
|
+
# Parse Selection object
|
14
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
15
|
+
# @return [Selection] result of parsing
|
16
|
+
def parse(node)
|
17
|
+
node.attributes.each do |key, value|
|
18
|
+
case key
|
19
|
+
when 'activeCell'
|
20
|
+
@active_cell = Coordinates.new.parse_string(value.value)
|
21
|
+
when 'activeCellId'
|
22
|
+
@active_cell_id = value.value.to_i
|
23
|
+
when 'sqref'
|
24
|
+
@reference_sequence = value.value.to_s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'sheet_view/pane'
|
4
|
+
require_relative 'sheet_view/selection'
|
4
5
|
module OoxmlParser
|
5
6
|
# Class for `sheetView` data
|
6
7
|
class SheetView < OOXMLDocumentObject
|
@@ -9,6 +10,14 @@ module OoxmlParser
|
|
9
10
|
attr_accessor :show_gridlines
|
10
11
|
# @return [True, False] Flag indicating whether the sheet should display row and column headings.
|
11
12
|
attr_accessor :show_row_column_headers
|
13
|
+
# @return [Coordinates] Reference to the top left cell
|
14
|
+
attr_reader :top_left_cell
|
15
|
+
# @return [Integer] Id of workbook view
|
16
|
+
attr_reader :workbook_view_id
|
17
|
+
# @return [Integer] Zoom scale
|
18
|
+
attr_reader :zoom_scale
|
19
|
+
# @return [Selection] Properties of selection
|
20
|
+
attr_reader :selection
|
12
21
|
|
13
22
|
def initialize(parent: nil)
|
14
23
|
@show_gridlines = true
|
@@ -20,12 +29,18 @@ module OoxmlParser
|
|
20
29
|
# @param node [Nokogiri::XML:Element] node to parse
|
21
30
|
# @return [SheetView] result of parsing
|
22
31
|
def parse(node)
|
23
|
-
node.attributes.
|
32
|
+
node.attributes.each do |key, value|
|
24
33
|
case key
|
25
34
|
when 'showGridLines'
|
26
|
-
@show_gridlines = attribute_enabled?(
|
35
|
+
@show_gridlines = attribute_enabled?(value)
|
27
36
|
when 'showRowColHeaders'
|
28
|
-
@show_row_column_headers = attribute_enabled?(
|
37
|
+
@show_row_column_headers = attribute_enabled?(value)
|
38
|
+
when 'topLeftCell'
|
39
|
+
@top_left_cell = Coordinates.new.parse_string(value.value)
|
40
|
+
when 'workbookViewId'
|
41
|
+
@workbook_view_id = value.value.to_i
|
42
|
+
when 'zoomScale'
|
43
|
+
@zoom_scale = value.value.to_i
|
29
44
|
end
|
30
45
|
end
|
31
46
|
|
@@ -33,6 +48,8 @@ module OoxmlParser
|
|
33
48
|
case node_child.name
|
34
49
|
when 'pane'
|
35
50
|
@pane = Pane.new(parent: self).parse(node_child)
|
51
|
+
when 'selection'
|
52
|
+
@selection = Selection.new(parent: self).parse(node_child)
|
36
53
|
end
|
37
54
|
end
|
38
55
|
self
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing <clientData> tag
|
5
|
+
class ClientData < OOXMLDocumentObject
|
6
|
+
# @return [True, False] Specifies if drawing is locked when sheet is protected
|
7
|
+
attr_reader :locks_with_sheet
|
8
|
+
|
9
|
+
def initialize(parent: nil)
|
10
|
+
@locks_with_sheet = true
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parse ClientData data
|
15
|
+
# @param [Nokogiri::XML:Element] node with ClientData data
|
16
|
+
# @return [Sheet] value of ClientData
|
17
|
+
def parse(node)
|
18
|
+
node.attributes.each do |key, value|
|
19
|
+
case key
|
20
|
+
when 'fLocksWithSheet'
|
21
|
+
@locks_with_sheet = attribute_enabled?(value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
self
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'xlsx_drawing/xlsx_drawing_position_parameters'
|
4
|
+
require_relative 'xlsx_drawing/client_data'
|
4
5
|
module OoxmlParser
|
5
6
|
# Data of spreadsheet drawing
|
6
7
|
class XlsxDrawing < OOXMLDocumentObject
|
@@ -11,6 +12,8 @@ module OoxmlParser
|
|
11
12
|
attr_accessor :to
|
12
13
|
# @return [GraphicFrame] graphic frame
|
13
14
|
attr_accessor :graphic_frame
|
15
|
+
# @return [ClientData] client data
|
16
|
+
attr_accessor :client_data
|
14
17
|
|
15
18
|
# Parse XlsxDrawing object
|
16
19
|
# @param node [Nokogiri::XML:Element] node to parse
|
@@ -32,6 +35,8 @@ module OoxmlParser
|
|
32
35
|
@graphic_frame = GraphicFrame.new(parent: self).parse(child_node)
|
33
36
|
when 'cxnSp'
|
34
37
|
@shape = ConnectionShape.new(parent: self).parse(child_node)
|
38
|
+
when 'clientData'
|
39
|
+
@client_data = ClientData.new(parent: self).parse(child_node)
|
35
40
|
end
|
36
41
|
end
|
37
42
|
self
|
@@ -34,7 +34,7 @@ module OoxmlParser
|
|
34
34
|
node.xpath('*').each do |node_child|
|
35
35
|
case node_child.name
|
36
36
|
when 'c'
|
37
|
-
@cells[Coordinates.
|
37
|
+
@cells[Coordinates.new.parse_string(node_child.attribute('r').value.to_s).column_number.to_i - 1] = XlsxCell.new(parent: self).parse(node_child)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
self
|
@@ -11,6 +11,8 @@ require_relative 'worksheet/xlsx_column_properties'
|
|
11
11
|
require_relative 'worksheet/xlsx_drawing'
|
12
12
|
require_relative 'worksheet/xlsx_row'
|
13
13
|
require_relative 'worksheet/xlsx_header_footer'
|
14
|
+
require_relative 'worksheet/sheet_protection'
|
15
|
+
require_relative 'worksheet/protected_range'
|
14
16
|
module OoxmlParser
|
15
17
|
# Properties of worksheet
|
16
18
|
class Worksheet < OOXMLDocumentObject
|
@@ -33,6 +35,10 @@ module OoxmlParser
|
|
33
35
|
attr_reader :header_footer
|
34
36
|
# @return [Array<ConditionalFormatting>] list of conditional formattings
|
35
37
|
attr_reader :conditional_formattings
|
38
|
+
# @return [SheetProtection] protection of sheet
|
39
|
+
attr_reader :sheet_protection
|
40
|
+
# @return [Array<ProtectedRange>] list of protected ranges
|
41
|
+
attr_reader :protected_ranges
|
36
42
|
|
37
43
|
def initialize(parent: nil)
|
38
44
|
@columns = []
|
@@ -45,6 +51,7 @@ module OoxmlParser
|
|
45
51
|
@sheet_views = []
|
46
52
|
@table_parts = []
|
47
53
|
@conditional_formattings = []
|
54
|
+
@protected_ranges = []
|
48
55
|
super
|
49
56
|
end
|
50
57
|
|
@@ -134,6 +141,12 @@ module OoxmlParser
|
|
134
141
|
@header_footer = XlsxHeaderFooter.new(parent: self).parse(worksheet_node_child)
|
135
142
|
when 'conditionalFormatting'
|
136
143
|
@conditional_formattings << ConditionalFormatting.new(parent: self).parse(worksheet_node_child)
|
144
|
+
when 'sheetProtection'
|
145
|
+
@sheet_protection = SheetProtection.new(parent: self).parse(worksheet_node_child)
|
146
|
+
when 'protectedRanges'
|
147
|
+
worksheet_node_child.xpath('*').each do |protected_range_node|
|
148
|
+
@protected_ranges << ProtectedRange.new(parent: self).parse(protected_range_node)
|
149
|
+
end
|
137
150
|
end
|
138
151
|
end
|
139
152
|
parse_comments
|
@@ -4,15 +4,19 @@ require_relative 'workbook/chartsheet'
|
|
4
4
|
require_relative 'workbook/pivot_cache'
|
5
5
|
require_relative 'workbook/pivot_table_definition'
|
6
6
|
require_relative 'workbook/defined_name'
|
7
|
+
require_relative 'workbook/workbook_protection'
|
7
8
|
require_relative 'workbook/shared_string_table'
|
8
9
|
require_relative 'workbook/style_sheet'
|
9
10
|
require_relative 'workbook/worksheet'
|
11
|
+
require_relative 'workbook/sheet'
|
10
12
|
require_relative 'workbook/workbook_helpers'
|
11
13
|
module OoxmlParser
|
12
14
|
# Class for storing XLSX Workbook
|
13
15
|
class XLSXWorkbook < CommonDocumentStructure
|
14
16
|
include WorkbookHelpers
|
15
17
|
attr_accessor :worksheets
|
18
|
+
# @return [Array<Sheet>] list of sheets
|
19
|
+
attr_reader :sheets
|
16
20
|
# @return [PresentationTheme] theme of Workbook
|
17
21
|
attr_accessor :theme
|
18
22
|
# @return [Relationships] rels of book
|
@@ -27,9 +31,12 @@ module OoxmlParser
|
|
27
31
|
attr_accessor :pivot_table_definitions
|
28
32
|
# @return [Array<DefinedName>] list of defined names
|
29
33
|
attr_reader :defined_names
|
34
|
+
# @return [WorkbookProtection] protection of workbook structure
|
35
|
+
attr_reader :workbook_protection
|
30
36
|
|
31
37
|
def initialize(params = {})
|
32
38
|
@worksheets = []
|
39
|
+
@sheets = []
|
33
40
|
@pivot_caches = []
|
34
41
|
@pivot_table_definitions = []
|
35
42
|
@defined_names = []
|
@@ -119,10 +126,11 @@ module OoxmlParser
|
|
119
126
|
@theme = PresentationTheme.parse("xl/#{link_to_theme_xml}") if link_to_theme_xml
|
120
127
|
@style_sheet = StyleSheet.new(parent: self).parse
|
121
128
|
@doc.xpath('xmlns:workbook/xmlns:sheets/xmlns:sheet').each do |sheet|
|
129
|
+
@sheets << Sheet.new(parent: self).parse(sheet)
|
122
130
|
file = @relationships.target_by_id(sheet.attribute('id').value)
|
123
131
|
if file.start_with?('worksheets')
|
124
132
|
@worksheets << Worksheet.new(parent: self).parse(file)
|
125
|
-
@worksheets.last.name =
|
133
|
+
@worksheets.last.name = @sheets.last.name
|
126
134
|
elsif file.start_with?('chartsheets')
|
127
135
|
@worksheets << Chartsheet.new(parent: self).parse(file)
|
128
136
|
end
|
@@ -130,6 +138,7 @@ module OoxmlParser
|
|
130
138
|
parse_pivot_cache
|
131
139
|
parse_pivot_table
|
132
140
|
parse_defined_names
|
141
|
+
parse_workbook_protection
|
133
142
|
OOXMLDocumentObject.xmls_stack.pop
|
134
143
|
self
|
135
144
|
end
|
@@ -161,5 +170,13 @@ module OoxmlParser
|
|
161
170
|
@defined_names << DefinedName.new(parent: self).parse(defined_name)
|
162
171
|
end
|
163
172
|
end
|
173
|
+
|
174
|
+
# Perform parsing of workbook protection
|
175
|
+
def parse_workbook_protection
|
176
|
+
workbook_protection = @doc.search('//xmlns:workbookProtection').first
|
177
|
+
return nil unless workbook_protection
|
178
|
+
|
179
|
+
@workbook_protection = WorkbookProtection.new(parent: self).parse(workbook_protection)
|
180
|
+
end
|
164
181
|
end
|
165
182
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ooxml_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-05-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -27,19 +27,19 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: ooxml_decrypt
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '1'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '1'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rubyzip
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,10 +250,8 @@ files:
|
|
250
250
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb
|
251
251
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb
|
252
252
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
|
253
|
-
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb
|
254
|
-
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb
|
255
253
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb
|
256
|
-
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/
|
254
|
+
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/style_matrix_reference.rb
|
257
255
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb
|
258
256
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
|
259
257
|
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb
|
@@ -360,6 +358,7 @@ files:
|
|
360
358
|
- lib/ooxml_parser/common_parser/common_data/valued_child.rb
|
361
359
|
- lib/ooxml_parser/common_parser/common_document_structure.rb
|
362
360
|
- lib/ooxml_parser/common_parser/parser.rb
|
361
|
+
- lib/ooxml_parser/common_parser/parser/encryption_checker.rb
|
363
362
|
- lib/ooxml_parser/configuration.rb
|
364
363
|
- lib/ooxml_parser/docx_parser/docx_data/document_structure.rb
|
365
364
|
- lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb
|
@@ -510,9 +509,11 @@ files:
|
|
510
509
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb
|
511
510
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb
|
512
511
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb
|
512
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/sheet.rb
|
513
513
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb
|
514
514
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb
|
515
515
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/alignment.rb
|
516
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/protection.rb
|
516
517
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb
|
517
518
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/differential_formatting_records.rb
|
518
519
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb
|
@@ -525,6 +526,7 @@ files:
|
|
525
526
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb
|
526
527
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb
|
527
528
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb
|
529
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_protection.rb
|
528
530
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb
|
529
531
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb
|
530
532
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb
|
@@ -532,9 +534,12 @@ files:
|
|
532
534
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
|
533
535
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb
|
534
536
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb
|
537
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/protected_range.rb
|
535
538
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb
|
539
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_protection.rb
|
536
540
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb
|
537
541
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb
|
542
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/selection.rb
|
538
543
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb
|
539
544
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb
|
540
545
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb
|
@@ -563,6 +568,7 @@ files:
|
|
563
568
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb
|
564
569
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb
|
565
570
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb
|
571
|
+
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/client_data.rb
|
566
572
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb
|
567
573
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_header_footer.rb
|
568
574
|
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_header_footer/header_footer_child.rb
|
@@ -588,14 +594,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
588
594
|
requirements:
|
589
595
|
- - ">="
|
590
596
|
- !ruby/object:Gem::Version
|
591
|
-
version: '2.
|
597
|
+
version: '2.6'
|
592
598
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
593
599
|
requirements:
|
594
600
|
- - ">="
|
595
601
|
- !ruby/object:Gem::Version
|
596
602
|
version: '0'
|
597
603
|
requirements: []
|
598
|
-
rubygems_version: 3.
|
604
|
+
rubygems_version: 3.3.12
|
599
605
|
signing_key:
|
600
606
|
specification_version: 4
|
601
607
|
summary: OoxmlParser Gem
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OoxmlParser
|
4
|
-
# Class for parsing `a:fillRef` tags
|
5
|
-
class FillReference < OOXMLDocumentObject
|
6
|
-
# @return [Integer] Style Matrix Index
|
7
|
-
attr_reader :index
|
8
|
-
# @return [Color] scheme color of FillReference
|
9
|
-
attr_reader :scheme_color
|
10
|
-
|
11
|
-
# Parse FillReference object
|
12
|
-
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
-
# @return [FillReference] result of parsing
|
14
|
-
def parse(node)
|
15
|
-
node.attributes.each do |key, value|
|
16
|
-
case key
|
17
|
-
when 'idx'
|
18
|
-
@index = value.value.to_f
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
node.xpath('*').each do |node_child|
|
23
|
-
case node_child.name
|
24
|
-
when 'schemeClr'
|
25
|
-
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
self
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OoxmlParser
|
4
|
-
# Class for parsing `a:lnRef` tags
|
5
|
-
class LineReference < OOXMLDocumentObject
|
6
|
-
# @return [Integer] Style Matrix Index
|
7
|
-
attr_reader :index
|
8
|
-
# @return [Color] scheme color of LineReference
|
9
|
-
attr_reader :scheme_color
|
10
|
-
|
11
|
-
# Parse LineReference object
|
12
|
-
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
-
# @return [LineReference] result of parsing
|
14
|
-
def parse(node)
|
15
|
-
node.attributes.each do |key, value|
|
16
|
-
case key
|
17
|
-
when 'idx'
|
18
|
-
@index = value.value.to_f
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
node.xpath('*').each do |node_child|
|
23
|
-
case node_child.name
|
24
|
-
when 'schemeClr'
|
25
|
-
@scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
self
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|