diff options
| author | Randy Morgan <[email protected]> | 2012-07-10 20:03:51 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-07-10 20:03:51 +0900 |
| commit | 8f0e868940fe7fd56e2c43e2b1102ec1d3e58a0e (patch) | |
| tree | f1ca3985d454980073aef0aa387626da565946c6 | |
| parent | cc4f75ce39528ed90c57208e83e319370408dd12 (diff) | |
| download | caxlsx-8f0e868940fe7fd56e2c43e2b1102ec1d3e58a0e.tar.gz caxlsx-8f0e868940fe7fd56e2c43e2b1102ec1d3e58a0e.zip | |
code updates for readability.
part of an ongoing effort to make the code more readable code.
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | examples/.~lock.chart_colors.xlsx# | 1 | ||||
| -rw-r--r-- | lib/axlsx/content_type/content_type.rb | 1 | ||||
| -rw-r--r-- | lib/axlsx/content_type/default.rb | 30 | ||||
| -rw-r--r-- | lib/axlsx/doc_props/app.rb | 58 | ||||
| -rw-r--r-- | notes_on_header_footer.md | 58 |
6 files changed, 108 insertions, 42 deletions
@@ -114,7 +114,7 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem, #Change log --------- - **July.??.12**: 1.1.8 release - - new - google docs interoperability + - new - first round google docs interoperability - added filter to strip out control characters from cell data. - added in interop requirements so that charts are properly exported to PDF from Libra Office diff --git a/examples/.~lock.chart_colors.xlsx# b/examples/.~lock.chart_colors.xlsx# new file mode 100644 index 00000000..e84eadc8 --- /dev/null +++ b/examples/.~lock.chart_colors.xlsx# @@ -0,0 +1 @@ +,randym,Morgans-MacBook-Air.local,08.07.2012 12:40,file:///Users/randym/Library/Application%20Support/LibreOffice/3;
\ No newline at end of file diff --git a/lib/axlsx/content_type/content_type.rb b/lib/axlsx/content_type/content_type.rb index 003991c7..6fa6f944 100644 --- a/lib/axlsx/content_type/content_type.rb +++ b/lib/axlsx/content_type/content_type.rb @@ -1,5 +1,6 @@ # encoding: UTF-8 module Axlsx + require 'axlsx/content_type/default.rb' require 'axlsx/content_type/override.rb' diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb index 21e89217..8baafb77 100644 --- a/lib/axlsx/content_type/default.rb +++ b/lib/axlsx/content_type/default.rb @@ -1,8 +1,22 @@ # encoding: UTF-8 module Axlsx + # An default content part. These parts are automatically created by for you based on the content of your package. class Default + #Creates a new Default object + # @option options [String] extension + # @option options [String] content_type + # @raise [ArgumentError] An argument error is raised if both extension and content_type are not specified. + def initialize(options={}) + raise ArgumentError, INVALID_ARGUMENTS unless validate_options(options) + options.each do |name, value| + self.send("#{name}=", value) if self.respond_to? "#{name}=" + end + end + + INVALID_ARGUMENTS = "extension and content_type are required" + # # The extension of the content type. # @return [String] attr_reader :extension @@ -13,18 +27,6 @@ module Axlsx attr_reader :content_type alias :ContentType :content_type - #Creates a new Default object - # @option options [String] extension - # @option options [String] content_type - # @raise [ArgumentError] An argument error is raised if both extension and content_type are not specified. - def initialize(options={}) - raise ArgumentError, "extension and content_type are required" unless (options[:Extension] || options[:extension]) && (options[:content_type] || options[:ContentType]) - options.each do |o| - self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - end - end - - # Sets the file extension for this content type. def extension=(v) Axlsx::validate_string v; @extension = v end alias :Extension= :extension= @@ -43,5 +45,9 @@ module Axlsx str << '/>' end + private + def validate_options(options) + (options[:Extension] || options[:extension]) && (options[:content_type] || options[:ContentType]) + end end end diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index 0d3968cd..52891e28 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -10,6 +10,35 @@ module Axlsx # DigSig (DigSigBlob) class App + # Creates an App object + # @option options [String] template + # @option options [String] manager + # @option options [Integer] pages + # @option options [Integer] words + # @option options [Integer] characters + # @option options [String] presentation_format + # @option options [Integer] lines + # @option options [Integer] paragraphs + # @option options [Integer] slides + # @option options [Integer] notes + # @option options [Integer] total_time + # @option options [Integer] hidden_slides + # @option options [Integer] m_m_clips + # @option options [Boolean] scale_crop + # @option options [Boolean] links_up_to_date + # @option options [Integer] characters_with_spaces + # @option options [Boolean] share_doc + # @option options [String] hyperlink_base + # @option options [String] hyperlinks_changed + # @option options [String] application + # @option options [String] app_version + # @option options [Integer] doc_security + def initialize(options={}) + options.each do |name, value| + self.send("#{name}=", value) if self.respond_to? "#{name}=" + end + end + # @return [String] The name of the document template. attr_reader :template alias :Template :template @@ -102,35 +131,6 @@ module Axlsx attr_reader :doc_security alias :DocSecurity :doc_security - # Creates an App object - # @option options [String] template - # @option options [String] manager - # @option options [Integer] pages - # @option options [Integer] words - # @option options [Integer] characters - # @option options [String] presentation_format - # @option options [Integer] lines - # @option options [Integer] paragraphs - # @option options [Integer] slides - # @option options [Integer] notes - # @option options [Integer] total_time - # @option options [Integer] hidden_slides - # @option options [Integer] m_m_clips - # @option options [Boolean] scale_crop - # @option options [Boolean] links_up_to_date - # @option options [Integer] characters_with_spaces - # @option options [Boolean] share_doc - # @option options [String] hyperlink_base - # @option options [String] hyperlinks_changed - # @option options [String] application - # @option options [String] app_version - # @option options [Integer] doc_security - def initialize(options={}) - options.each do |o| - self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - end - end - # Sets the template property of your app.xml file def template=(v) Axlsx::validate_string v; @template = v; end alias :Template :template diff --git a/notes_on_header_footer.md b/notes_on_header_footer.md new file mode 100644 index 00000000..c22f31eb --- /dev/null +++ b/notes_on_header_footer.md @@ -0,0 +1,58 @@ +## positioning +&L - code for "left section" + +&C - code for "center section". + +&R - code for "right section". + +(there are three header / footer locations, "left", "center", and "right"). When two or +more occurrences of a section marker exist, the contents from all identical markers are concatenated, in the order of +appearance, and placed into the section section. + +## font styles + +&font size - code for "text font size", where font size is a font size in points. + +&K - code for "text font color" + - RGB Color is specified as RRGGBB + - Theme Color is specified as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value. + +&"font name,font type" - code for "text font name" and "text font type" where font name and font type + are strings specifying the name and type of the font, separated by a comma. When a hyphen appears +in font name it means none specified. Both of font name and font type can be localized values. +Although ISO/IEC 14496-22 permits commas in font family/subfamily/full names, name and font type +, the lexically first comma in the font name is the one recognized as the separating comma. + +&"-,Bold" - code for "bold font style" + +&B - also means "bold font style". + +&"-,Regular" - code for "regular font style" + +&"-,Italic" - code for "italic font style" +&I - also means "italic font style" + +&"-,Bold Italic" code for "bold italic font style" + +&S - code for "text strikethrough" on / off +&X - code for "text super script" on / off +&Y - code for "text subscript" on / off + + +## Workbook info and page numbering + +&P - code for "current page #" +&N - code for "total pages" +&D - code for "date" +&T - code for "time" +&G - code for "picture as background" +&U - code for "text single underline" +&E - code for "double underline" +&Z - code for "this workbook's file path" +&F - code for "this workbook's file name" +&A - code for "sheet tab name" +&+ - code for add to page #. +&- - code for subtract from page #. + +&O - code for "outline style" +&H - code for "shadow style" |
