From 2d0ac967e94c5944ccccf9adad8da5a9d082df29 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 20 Nov 2011 23:44:58 +0900 Subject: pushing docs --- .yardoc/objects/root.dat | Bin 406709 -> 406450 bytes axlsx-1.0.1.a.gem | Bin 0 -> 160768 bytes axlsx.gemspec | 1 - doc/Axlsx.html | 2443 +++++++++++++++++++++++++++++ doc/Axlsx/App.html | 2640 +++++++++++++++++++++++++++++++ doc/Axlsx/Axis.html | 1047 +++++++++++++ doc/Axlsx/Bar3DChart.html | 1153 ++++++++++++++ doc/Axlsx/BarSeries.html | 762 +++++++++ doc/Axlsx/Border.html | 775 ++++++++++ doc/Axlsx/BorderPr.html | 709 +++++++++ doc/Axlsx/CatAxis.html | 766 +++++++++ doc/Axlsx/Cell.html | 1623 ++++++++++++++++++++ doc/Axlsx/CellAlignment.html | 1247 +++++++++++++++ doc/Axlsx/CellProtection.html | 565 +++++++ doc/Axlsx/CellStyle.html | 949 ++++++++++++ doc/Axlsx/Chart.html | 1369 +++++++++++++++++ doc/Axlsx/Color.html | 665 ++++++++ doc/Axlsx/ContentType.html | 340 ++++ doc/Axlsx/Core.html | 465 ++++++ doc/Axlsx/DataTypeValidator.html | 324 ++++ doc/Axlsx/Default.html | 575 +++++++ doc/Axlsx/Drawing.html | 1154 ++++++++++++++ doc/Axlsx/Fill.html | 460 ++++++ doc/Axlsx/Font.html | 1554 +++++++++++++++++++ doc/Axlsx/GradientFill.html | 1026 +++++++++++++ doc/Axlsx/GradientStop.html | 526 +++++++ doc/Axlsx/GraphicFrame.html | 646 ++++++++ doc/Axlsx/Marker.html | 857 +++++++++++ doc/Axlsx/NumFmt.html | 562 +++++++ doc/Axlsx/Override.html | 568 +++++++ doc/Axlsx/Package.html | 1293 ++++++++++++++++ doc/Axlsx/PatternFill.html | 681 ++++++++ doc/Axlsx/Pie3DChart.html | 439 ++++++ doc/Axlsx/PieSeries.html | 762 +++++++++ doc/Axlsx/RegexValidator.html | 268 ++++ doc/Axlsx/Relationship.html | 554 +++++++ doc/Axlsx/Relationships.html | 343 +++++ doc/Axlsx/RestrictionValidator.html | 300 ++++ doc/Axlsx/Row.html | 771 ++++++++++ doc/Axlsx/Scaling.html | 740 +++++++++ doc/Axlsx/Series.html | 750 +++++++++ doc/Axlsx/SimpleTypedList.html | 1617 +++++++++++++++++++ doc/Axlsx/Styles.html | 1754 +++++++++++++++++++++ doc/Axlsx/TableStyle.html | 710 +++++++++ doc/Axlsx/TableStyleElement.html | 677 ++++++++ doc/Axlsx/TableStyles.html | 599 ++++++++ doc/Axlsx/Title.html | 621 ++++++++ doc/Axlsx/TwoCellAnchor.html | 1115 ++++++++++++++ doc/Axlsx/ValAxis.html | 539 +++++++ doc/Axlsx/View3D.html | 971 ++++++++++++ doc/Axlsx/Workbook.html | 1347 ++++++++++++++++ doc/Axlsx/Worksheet.html | 1864 ++++++++++++++++++++++ doc/Axlsx/Xf.html | 1681 ++++++++++++++++++++ doc/_index.html | 575 +++++++ doc/class_list.html | 47 + doc/css/common.css | 1 + doc/css/full_list.css | 55 + doc/css/style.css | 322 ++++ doc/file.README.html | 136 ++ doc/file_list.html | 49 + doc/frames.html | 13 + doc/index.html | 136 ++ doc/js/app.js | 205 +++ doc/js/full_list.js | 167 ++ doc/js/jquery.js | 16 + doc/method_list.html | 2902 +++++++++++++++++++++++++++++++++++ doc/top-level-namespace.html | 103 ++ 67 files changed, 50893 insertions(+), 1 deletion(-) create mode 100644 axlsx-1.0.1.a.gem create mode 100644 doc/Axlsx.html create mode 100644 doc/Axlsx/App.html create mode 100644 doc/Axlsx/Axis.html create mode 100644 doc/Axlsx/Bar3DChart.html create mode 100644 doc/Axlsx/BarSeries.html create mode 100644 doc/Axlsx/Border.html create mode 100644 doc/Axlsx/BorderPr.html create mode 100644 doc/Axlsx/CatAxis.html create mode 100644 doc/Axlsx/Cell.html create mode 100644 doc/Axlsx/CellAlignment.html create mode 100644 doc/Axlsx/CellProtection.html create mode 100644 doc/Axlsx/CellStyle.html create mode 100644 doc/Axlsx/Chart.html create mode 100644 doc/Axlsx/Color.html create mode 100644 doc/Axlsx/ContentType.html create mode 100644 doc/Axlsx/Core.html create mode 100644 doc/Axlsx/DataTypeValidator.html create mode 100644 doc/Axlsx/Default.html create mode 100644 doc/Axlsx/Drawing.html create mode 100644 doc/Axlsx/Fill.html create mode 100644 doc/Axlsx/Font.html create mode 100644 doc/Axlsx/GradientFill.html create mode 100644 doc/Axlsx/GradientStop.html create mode 100644 doc/Axlsx/GraphicFrame.html create mode 100644 doc/Axlsx/Marker.html create mode 100644 doc/Axlsx/NumFmt.html create mode 100644 doc/Axlsx/Override.html create mode 100644 doc/Axlsx/Package.html create mode 100644 doc/Axlsx/PatternFill.html create mode 100644 doc/Axlsx/Pie3DChart.html create mode 100644 doc/Axlsx/PieSeries.html create mode 100644 doc/Axlsx/RegexValidator.html create mode 100644 doc/Axlsx/Relationship.html create mode 100644 doc/Axlsx/Relationships.html create mode 100644 doc/Axlsx/RestrictionValidator.html create mode 100644 doc/Axlsx/Row.html create mode 100644 doc/Axlsx/Scaling.html create mode 100644 doc/Axlsx/Series.html create mode 100644 doc/Axlsx/SimpleTypedList.html create mode 100644 doc/Axlsx/Styles.html create mode 100644 doc/Axlsx/TableStyle.html create mode 100644 doc/Axlsx/TableStyleElement.html create mode 100644 doc/Axlsx/TableStyles.html create mode 100644 doc/Axlsx/Title.html create mode 100644 doc/Axlsx/TwoCellAnchor.html create mode 100644 doc/Axlsx/ValAxis.html create mode 100644 doc/Axlsx/View3D.html create mode 100644 doc/Axlsx/Workbook.html create mode 100644 doc/Axlsx/Worksheet.html create mode 100644 doc/Axlsx/Xf.html create mode 100644 doc/_index.html create mode 100644 doc/class_list.html create mode 100644 doc/css/common.css create mode 100644 doc/css/full_list.css create mode 100644 doc/css/style.css create mode 100644 doc/file.README.html create mode 100644 doc/file_list.html create mode 100644 doc/frames.html create mode 100644 doc/index.html create mode 100644 doc/js/app.js create mode 100644 doc/js/full_list.js create mode 100644 doc/js/jquery.js create mode 100644 doc/method_list.html create mode 100644 doc/top-level-namespace.html diff --git a/.yardoc/objects/root.dat b/.yardoc/objects/root.dat index 98988407..72bd306a 100644 Binary files a/.yardoc/objects/root.dat and b/.yardoc/objects/root.dat differ diff --git a/axlsx-1.0.1.a.gem b/axlsx-1.0.1.a.gem new file mode 100644 index 00000000..81402856 Binary files /dev/null and b/axlsx-1.0.1.a.gem differ diff --git a/axlsx.gemspec b/axlsx.gemspec index 84681a16..3eeaf9ca 100644 --- a/axlsx.gemspec +++ b/axlsx.gemspec @@ -17,5 +17,4 @@ EOF s.add_runtime_dependency 'active_support', '~> 3' s.add_runtime_dependency 'rmagick', '~> 2.12' s.add_runtime_dependency 'rubyzip', '~> 0.9.4' - end diff --git a/doc/Axlsx.html b/doc/Axlsx.html new file mode 100644 index 00000000..287a5c12 --- /dev/null +++ b/doc/Axlsx.html @@ -0,0 +1,2443 @@ + + + + + + Module: Axlsx + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Module: Axlsx + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/axlsx/package.rb,
+ lib/axlsx.rb,
lib/axlsx/drawing/axis.rb,
lib/axlsx/drawing/chart.rb,
lib/axlsx/stylesheet/xf.rb,
lib/axlsx/doc_props/app.rb,
lib/axlsx/drawing/title.rb,
lib/axlsx/util/constants.rb,
lib/axlsx/doc_props/core.rb,
lib/axlsx/drawing/marker.rb,
lib/axlsx/drawing/series.rb,
lib/axlsx/drawing/view_3D.rb,
lib/axlsx/util/validators.rb,
lib/axlsx/stylesheet/font.rb,
lib/axlsx/stylesheet/fill.rb,
lib/axlsx/drawing/scaling.rb,
lib/axlsx/drawing/drawing.rb,
lib/axlsx/drawing/cat_axis.rb,
lib/axlsx/stylesheet/color.rb,
lib/axlsx/drawing/val_axis.rb,
lib/axlsx/stylesheet/styles.rb,
lib/axlsx/workbook/workbook.rb,
lib/axlsx/rels/relationship.rb,
lib/axlsx/stylesheet/border.rb,
lib/axlsx/rels/relationships.rb,
lib/axlsx/drawing/bar_series.rb,
lib/axlsx/drawing/pie_series.rb,
lib/axlsx/stylesheet/num_fmt.rb,
lib/axlsx/drawing/bar_3D_chart.rb,
lib/axlsx/stylesheet/border_pr.rb,
lib/axlsx/content_type/default.rb,
lib/axlsx/drawing/pie_3D_chart.rb,
lib/axlsx/content_type/override.rb,
lib/axlsx/stylesheet/cell_style.rb,
lib/axlsx/drawing/graphic_frame.rb,
lib/axlsx/util/simple_typed_list.rb,
lib/axlsx/workbook/worksheet/row.rb,
lib/axlsx/stylesheet/table_style.rb,
lib/axlsx/stylesheet/pattern_fill.rb,
lib/axlsx/stylesheet/table_styles.rb,
lib/axlsx/workbook/worksheet/cell.rb,
lib/axlsx/drawing/two_cell_anchor.rb,
lib/axlsx/stylesheet/gradient_stop.rb,
lib/axlsx/stylesheet/gradient_fill.rb,
lib/axlsx/stylesheet/cell_alignment.rb,
lib/axlsx/content_type/content_type.rb,
lib/axlsx/stylesheet/cell_protection.rb,
lib/axlsx/workbook/worksheet/worksheet.rb,
lib/axlsx/stylesheet/table_style_element.rb
+
+ +
+
+ +

Overview

+
+

+Create Office Open XML Spreadsheets (xlsx) with safe and full control over +cell styles, automatically resized column widths and 3D pie charts. +

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: App, Axis, Bar3DChart, BarSeries, Border, BorderPr, CatAxis, Cell, CellAlignment, CellProtection, CellStyle, Chart, Color, ContentType, Core, DataTypeValidator, Default, Drawing, Fill, Font, GradientFill, GradientStop, GraphicFrame, Marker, NumFmt, Override, Package, PatternFill, Pie3DChart, PieSeries, RegexValidator, Relationship, Relationships, RestrictionValidator, Row, Scaling, Series, SimpleTypedList, Styles, TableStyle, TableStyleElement, TableStyles, Title, TwoCellAnchor, ValAxis, View3D, Workbook, Worksheet, Xf + + +

+ +

Constant Summary

+ +
+ +
VERSION = +
+
+

+version +

+ + +
+
+
+ + +
+
+
"1.0.1.a"
+
+ +
ENCODING = +
+
+

+XML Encoding +

+ + +
+
+
+ + +
+
+
"UTF-8"
+
+ +
XML_NS = +
+
+

+spreadsheetML namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
+
+ +
XML_NS_T = +
+
+

+content-types namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/package/2006/content-types"
+
+ +
APP_NS = +
+
+

+extended-properties namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
+
+ +
APP_NS_VT = +
+
+

+doc props namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
+
+ +
CORE_NS = +
+
+

+core properties namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+
+ +
CORE_NS_DC = +
+
+

+dc elements (core) namespace +

+ + +
+
+
+ + +
+
+
"http://purl.org/dc/elements/1.1/"
+
+ +
CORE_NS_DCMIT = +
+
+

+dcmit (core) namespcace +

+ + +
+
+
+ + +
+
+
"http://purl.org/dc/dcmitype/"
+
+ +
CORE_NS_DCT = +
+
+

+dc terms namespace +

+ + +
+
+
+ + +
+
+
"http://purl.org/dc/terms/"
+
+ +
CORE_NS_XSI = +
+
+

+xml schema namespace +

+ + +
+
+
+ + +
+
+
"http://www.w3.org/2001/XMLSchema-instance"
+
+ +
XML_NS_XDR = +
+
+

+spreadsheet drawing namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
+
+ +
XML_NS_A = +
+
+

+drawing namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/drawingml/2006/main"
+
+ +
XML_NS_C = +
+
+

+chart namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/drawingml/2006/chart"
+
+ +
XML_NS_R = +
+
+

+relationships namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+
+ +
RELS_R = +
+
+

+relationships name space +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/package/2006/relationships"
+
+ +
TABLE_R = +
+
+

+table rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
+
+ +
WORKBOOK_R = +
+
+

+workbook rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
+
+ +
WORKSHEET_R = +
+
+

+worksheet rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
+
+ +
APP_R = +
+
+

+app rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
+
+ +
CORE_R = +
+
+

+core rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata/core-properties"
+
+ +
STYLES_R = +
+
+

+styles rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
+
+ +
DRAWING_R = +
+
+

+drawing rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
+
+ +
CHART_R = +
+
+

+chart rels namespace +

+ + +
+
+
+ + +
+
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
+
+ +
TABLE_CT = +
+
+

+table content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
+
+ +
WORKBOOK_CT = +
+
+

+workbook content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
+
+ +
APP_CT = +
+
+

+app content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.extended-properties+xml"
+
+ +
RELS_CT = +
+
+

+rels content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-package.relationships+xml"
+
+ +
STYLES_CT = +
+
+

+styles content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
+
+ +
XML_CT = +
+
+

+xml content type +

+ + +
+
+
+ + +
+
+
"application/xml"
+
+ +
WORKSHEET_CT = +
+
+

+worksheet content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
+
+ +
SHARED_STRINGS_CT = +
+
+

+shared strings content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
+
+ +
CORE_CT = +
+
+

+core content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-package.core-properties+xml"
+
+ +
CHART_CT = +
+
+

+chart content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
+
+ +
DRAWING_CT = +
+
+

+drawing content type +

+ + +
+
+
+ + +
+
+
"application/vnd.openxmlformats-officedocument.drawing+xml"
+
+ +
XML_EX = +
+
+

+xml content type extensions +

+ + +
+
+
+ + +
+
+
"xml"
+
+ +
RELS_EX = +
+
+

+rels content type extension +

+ + +
+
+
+ + +
+
+
"rels"
+
+ +
WORKBOOK_PN = +
+
+

+workbook part +

+ + +
+
+
+ + +
+
+
"xl/workbook.xml"
+
+ +
STYLES_PN = +
+
+

+styles part +

+ + +
+
+
+ + +
+
+
"styles.xml"
+
+ +
APP_PN = +
+
+

+app part +

+ + +
+
+
+ + +
+
+
"docProps/app.xml"
+
+ +
CORE_PN = +
+
+

+core part +

+ + +
+
+
+ + +
+
+
"docProps/core.xml"
+
+ +
CONTENT_TYPES_PN = +
+
+

+content types part +

+ + +
+
+
+ + +
+
+
"[Content_Types].xml"
+
+ +
RELS_PN = +
+
+

+rels part +

+ + +
+
+
+ + +
+
+
"_rels/.rels"
+
+ +
WORKBOOK_RELS_PN = +
+
+

+workbook rels part +

+ + +
+
+
+ + +
+
+
"xl/_rels/workbook.xml.rels"
+
+ +
WORKSHEET_PN = +
+
+

+worksheet part +

+ + +
+
+
+ + +
+
+
"worksheets/sheet%d.xml"
+
+ +
WORKSHEET_RELS_PN = +
+
+

+worksheet rels part +

+ + +
+
+
+ + +
+
+
"worksheets/_rels/sheet%d.xml.rels"
+
+ +
DRAWING_PN = +
+
+

+drawing part +

+ + +
+
+
+ + +
+
+
"drawings/drawing%d.xml"
+
+ +
DRAWING_RELS_PN = +
+
+

+drawing rels part +

+ + +
+
+
+ + +
+
+
"drawings/_rels/drawing%d.xml.rels"
+
+ +
CHART_PN = +
+
+

+chart part +

+ + +
+
+
+ + +
+
+
"charts/chart%d.xml"
+
+ +
APP_XSD = +
+
+

+App validation schema +

+ + +
+
+
+ + +
+
+
"lib/schema/shared-documentPropertiesExtended.xsd"
+
+ +
CORE_XSD = +
+
+

+core validation schema +

+ + +
+
+
+ + +
+
+
"lib/schema/opc-coreProperties.xsd"
+
+ +
CONTENT_TYPES_XSD = +
+
+

+content types validation schema +

+ + +
+
+
+ + +
+
+
"lib/schema/opc-contentTypes.xsd"
+
+ +
RELS_XSD = +
+
+

+rels validation schema +

+ + +
+
+
+ + +
+
+
"lib/schema/opc-relationships.xsd"
+
+ +
SML_XSD = +
+
+

+spreadsheetML validation schema +

+ + +
+
+
+ + +
+
+
"lib/schema/sml.xsd"
+
+ +
DRAWING_XSD = +
+
+

+drawing validation schema +

+ + +
+
+
+ + +
+
+
"lib/schema/dml-spreadsheetDrawing.xsd"
+
+ +
NUM_FMT_PERCENT = +
+
+

+number format id for pecentage formatting using the default formatting id. +

+ + +
+
+
+ + +
+
+
9
+
+ +
NUM_FMT_YYYYMMDD = +
+
+

+number format id for date format like 2011/11/13 +

+ + +
+
+
+ + +
+
+
100
+
+ +
NUM_FMT_YYYYMMDDHHMMSS = +
+
+

+number format id for time format the creates 2011/11/13 12:23:10 +

+ + +
+
+
+ + +
+
+
101
+
+ +
STYLE_THIN_BORDER = +
+
+

+cellXfs id for thin borders around the cell +

+ + +
+
+
+ + +
+
+
1
+
+ +
ERR_RESTRICTION = +
+
+

+error messages RestrictionValidor +

+ + +
+
+
+ + +
+
+
"Invalid Data: %s. %s must be one of %s."
+
+ +
ERR_TYPE = +
+
+

+error message DataTypeValidator +

+ + +
+
+
+ + +
+
+
"Invalid Data %s for %s. must be %s."
+
+ +
ERR_REGEX = +
+
+

+error message for RegexValidator +

+ + +
+
+
+ + +
+
+
"Invalid Data. %s does not match %s."
+
+ +
+ + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) cell_range(items) + + + +

+
+

+determines the cell range for the items provided +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+31
+32
+33
+34
+35
+
+
# File 'lib/axlsx.rb', line 31
+
+def self.cell_range(items)
+  return "" unless items.first.is_a? Cell          
+  "#{items.first.row.worksheet.name}!" +
+    "#{items.first.r_abs}:#{items.last.r_abs}"
+end
+
+
+
+ +
+

+ + + (Object) validate_boolean(v) + + + +

+
+

+Requires that the value is a form that can be evaluated as a boolean in an +xml document. The value must be an instance of Fixnum, String, Integer, +Symbol, TrueClass or FalseClass and it must be one of 0, 1, +"true", "false", :true, :false, true, false, +"0", or "1" +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/axlsx/util/validators.rb', line 65
+
+def self.validate_boolean(v)
+  DataTypeValidator.validate(:boolean, [Fixnum, String, Integer, Symbol, TrueClass, FalseClass], v, lambda { |v| [0, 1, "true", "false", :true, :false, true, false, "0", "1"].include?(v) })
+end
+
+
+
+ +
+

+ + + (Object) validate_content_type(v) + + + +

+
+

+Requires that the value is a valid content_type TABLE_CT, WORKBOOK_CT, +APP_CT, RELS_CT, STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, +CORE_CT, CHART_CT, DRAWING_CT are allowed +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+114
+115
+116
+
+
# File 'lib/axlsx/util/validators.rb', line 114
+
+def self.validate_content_type(v)
+  RestrictionValidator.validate :content_type, [TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, DRAWING_CT], v
+end
+
+
+
+ +
+

+ + + (Object) validate_float(v) + + + +

+
+

+Requires that the value is a Float +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+77
+78
+79
+
+
# File 'lib/axlsx/util/validators.rb', line 77
+
+def self.validate_float(v)
+  DataTypeValidator.validate :float, Float, v
+end
+
+
+
+ +
+

+ + + (Object) validate_gradient_type(v) + + + +

+
+

+Requires that the value is a gradient_type. valid types are :linear and +:path +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+93
+94
+95
+
+
# File 'lib/axlsx/util/validators.rb', line 93
+
+def self.validate_gradient_type(v)
+  RestrictionValidator.validate :gradient_type, [:linear, :path], v
+end
+
+
+
+ +
+

+ + + (Object) validate_horizontal_alignment(v) + + + +

+
+

+Requires that the value is a valid horizontal_alignment :general, :left, +:center, :right, :fill, :justify, :centerContinuous, :distributed are +allowed +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+100
+101
+102
+
+
# File 'lib/axlsx/util/validators.rb', line 100
+
+def self.validate_horizontal_alignment(v)
+  RestrictionValidator.validate :horizontal_alignment, [:general, :left, :center, :right, :fill, :justify, :centerContinuous, :distributed], v
+end
+
+
+
+ +
+

+ + + (Object) validate_int(v) + + + +

+
+

+Requires that the value is a Fixnum or Integer +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+57
+58
+59
+
+
# File 'lib/axlsx/util/validators.rb', line 57
+
+def self.validate_int(v)
+  DataTypeValidator.validate :unsigned_int, [Fixnum, Integer], v
+end
+
+
+
+ +
+

+ + + (Object) validate_pattern_type(v) + + + +

+
+

+Requires that the value is valid pattern type. valid pattern types must be +one of :none, :solid, :mediumGray, :darkGray, :lightGray, :darkHorizontal, +:darkVertical, :darkDown, :darkUp, :darkGrid, :darkTrellis, +:lightHorizontal, :lightVertical, :lightDown, :lightUp, :lightGrid, +:lightTrellis, :gray125, or :gray0625. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+85
+86
+87
+88
+
+
# File 'lib/axlsx/util/validators.rb', line 85
+
+def self.validate_pattern_type(v)
+  RestrictionValidator.validate :pattern_type, [:none, :solid, :mediumGray, :darkGray, :lightGray, :darkHorizontal, :darkVertical, :darkDown, :darkUp, :darkGrid,
+     :darkTrellis, :lightHorizontal, :lightVertical, :lightDown, :lightUp, :lightGrid, :lightTrellis, :gray125, :gray0625], v
+end
+
+
+
+ +
+

+ + + (Object) validate_relationship_type(v) + + + +

+
+

+Requires that the value is a valid relationship_type XML_NS_R, TABLE_R, +WORKBOOK_R, WORKSHEET_R, APP_R, RELS_R, CORE_R, STYLES_R, CHART_R, +DRAWING_R are allowed +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+121
+122
+123
+
+
# File 'lib/axlsx/util/validators.rb', line 121
+
+def self.validate_relationship_type(v)
+  RestrictionValidator.validate :relationship_type, [XML_NS_R, TABLE_R, WORKBOOK_R, WORKSHEET_R, APP_R, RELS_R, CORE_R, STYLES_R, CHART_R, DRAWING_R], v
+end
+
+
+
+ +
+

+ + + (Object) validate_string(v) + + + +

+
+

+Requires that the value is a String +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+71
+72
+73
+
+
# File 'lib/axlsx/util/validators.rb', line 71
+
+def self.validate_string(v)
+  DataTypeValidator.validate :string, String, v
+end
+
+
+
+ +
+

+ + + (Object) validate_table_element_type(v) + + + +

+
+

+Requires that the value is a valid table element type :wholeTable, +:headerRow, :totalRow, :firstColumn, :lastColumn, :firstRowStripe, +:secondRowStripe, :firstColumnStripe, :secondColumnStripe, +:firstHeaderCell, :lastHeaderCell, :firstTotalCell, :lastTotalCell, +:firstSubtotalColumn, :secondSubtotalColumn, :thirdSubtotalColumn, +:firstSubtotalRow, :secondSubtotalRow, :thirdSubtotalRow, :blankRow, +:firstColumnSubheading, :secondColumnSubheading, :thirdColumnSubheading, +:firstRowSubheading, :secondRowSubheading, :thirdRowSubheading, +:pageFieldLabels, :pageFieldValues are allowed +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+128
+129
+130
+
+
# File 'lib/axlsx/util/validators.rb', line 128
+
+def self.validate_table_element_type(v)
+  RestrictionValidator.validate :table_element_type, [:wholeTable, :headerRow, :totalRow, :firstColumn, :lastColumn, :firstRowStripe, :secondRowStripe, :firstColumnStripe, :secondColumnStripe, :firstHeaderCell, :lastHeaderCell, :firstTotalCell, :lastTotalCell, :firstSubtotalColumn, :secondSubtotalColumn, :thirdSubtotalColumn, :firstSubtotalRow, :secondSubtotalRow, :thirdSubtotalRow, :blankRow, :firstColumnSubheading, :secondColumnSubheading, :thirdColumnSubheading, :firstRowSubheading, :secondRowSubheading, :thirdRowSubheading, :pageFieldLabels, :pageFieldValues], v
+end
+
+
+
+ +
+

+ + + (Boolean) validate_unsigned_int(v) + + + +

+
+

+Requires that the value is a Fixnum or Integer and is greater or equal to 0 +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +true if the data is valid +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +raised if the value is not a Fixnum or Integer value greater or equal to 0 +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/axlsx/util/validators.rb', line 51
+
+def self.validate_unsigned_int(v)
+  DataTypeValidator.validate(:unsigned_int, [Fixnum, Integer], v, lambda { |v| v.respond_to?(:>=) && v >= 0 })
+end
+
+
+
+ +
+

+ + + (Object) validate_vertical_alignment(v) + + + +

+
+

+Requires that the value is a valid vertical_alignment :top, :center, +:bottom, :justify, :distributed are allowed +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The value validated +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+107
+108
+109
+
+
# File 'lib/axlsx/util/validators.rb', line 107
+
+def self.validate_vertical_alignment(v)
+  RestrictionValidator.validate :vertical_alignment, [:top, :center, :bottom, :justify, :distributed], v
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/App.html b/doc/Axlsx/App.html new file mode 100644 index 00000000..c4f9169c --- /dev/null +++ b/doc/Axlsx/App.html @@ -0,0 +1,2640 @@ + + + + + + Class: Axlsx::App + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::App + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/doc_props/app.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Support is not implemented for the following complex types: +

+

+HeadingPairs (VectorVariant), TitlesOfParts (VectorLpstr), HLinks +(VectorVariant), DigSig (DigSigBlob) +

+
+
+ +

+App represents the app.xml document. The attributes for this object are +primarily managed by the application the end user uses to edit the +document. None of the attributes are required to serialize a valid xlsx +object. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • shared-documentPropertiesExtendedshared-documentPropertiesExtended.xsd
  • + +
+ +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) Application + + + +

+
+

+The name of the application +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The name of the application +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+
+
# File 'lib/axlsx/doc_props/app.rb', line 74
+
+def Application
+  @Application
+end
+
+
+
+ + + + +
+

+ + - (String) AppVersion + + + +

+
+

+The version of the application. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The version of the application. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+77
+78
+79
+
+
# File 'lib/axlsx/doc_props/app.rb', line 77
+
+def AppVersion
+  @AppVersion
+end
+
+
+
+ + + + +
+

+ + - (Integer) Characters + + + +

+
+

+The number of characters in the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of characters in the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/axlsx/doc_props/app.rb', line 29
+
+def Characters
+  @Characters
+end
+
+
+
+ + + + +
+

+ + - (Integer) CharactersWithSpaces + + + +

+
+

+The number of characters in the document including spaces. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of characters in the document including spaces. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/axlsx/doc_props/app.rb', line 62
+
+def CharactersWithSpaces
+  @CharactersWithSpaces
+end
+
+
+
+ + + + +
+

+ + - (String) Company + + + +

+
+

+The name of the company generating the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The name of the company generating the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/axlsx/doc_props/app.rb', line 20
+
+def Company
+  @Company
+end
+
+
+
+ + + + +
+

+ + - (Integer) DocSecurity + + + +

+
+

+Document security +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +Document security +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+80
+81
+82
+
+
# File 'lib/axlsx/doc_props/app.rb', line 80
+
+def DocSecurity
+  @DocSecurity
+end
+
+
+
+ + + + +
+

+ + - (Integer) HiddenSlides + + + +

+
+

+The number of hidden slides. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of hidden slides. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/axlsx/doc_props/app.rb', line 50
+
+def HiddenSlides
+  @HiddenSlides
+end
+
+
+
+ + + + +
+

+ + - (String) HyperLinkBase + + + +

+
+

+The base for hyper links in the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The base for hyper links in the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+68
+69
+70
+
+
# File 'lib/axlsx/doc_props/app.rb', line 68
+
+def HyperLinkBase
+  @HyperLinkBase
+end
+
+
+
+ + + + +
+

+ + - (Boolean) HyperlinksChanged + + + +

+
+

+Indicates that the hyper links in the document have been changed. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +Indicates that the hyper links in the document have been changed. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+71
+72
+73
+
+
# File 'lib/axlsx/doc_props/app.rb', line 71
+
+def HyperlinksChanged
+  @HyperlinksChanged
+end
+
+
+
+ + + + +
+

+ + - (Integer) Lines + + + +

+
+

+The number of lines in the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of lines in the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/axlsx/doc_props/app.rb', line 35
+
+def Lines
+  @Lines
+end
+
+
+
+ + + + +
+

+ + - (Boolean) LinksUpToDate + + + +

+
+

+The links in the document are up to date. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +The links in the document are up to date. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/axlsx/doc_props/app.rb', line 59
+
+def LinksUpToDate
+  @LinksUpToDate
+end
+
+
+
+ + + + +
+

+ + - (String) Manager + + + +

+
+

+The name of the manager for the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The name of the manager for the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/axlsx/doc_props/app.rb', line 17
+
+def Manager
+  @Manager
+end
+
+
+
+ + + + +
+

+ + - (Integer) MMClips + + + +

+
+

+The total number multimedia clips +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The total number multimedia clips +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+53
+54
+55
+
+
# File 'lib/axlsx/doc_props/app.rb', line 53
+
+def MMClips
+  @MMClips
+end
+
+
+
+ + + + +
+

+ + - (Integer) Notes + + + +

+
+

+The number of slides that have notes. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of slides that have notes. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/axlsx/doc_props/app.rb', line 44
+
+def Notes
+  @Notes
+end
+
+
+
+ + + + +
+

+ + - (Integer) Pages + + + +

+
+

+The number of pages in the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of pages in the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/axlsx/doc_props/app.rb', line 23
+
+def Pages
+  @Pages
+end
+
+
+
+ + + + +
+

+ + - (Integer) Paragraphs + + + +

+
+

+The number of paragraphs in the document +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of paragraphs in the document +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/doc_props/app.rb', line 38
+
+def Paragraphs
+  @Paragraphs
+end
+
+
+
+ + + + +
+

+ + - (String) PresentationFormat + + + +

+
+

+The intended format of the presentation. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The intended format of the presentation. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/axlsx/doc_props/app.rb', line 32
+
+def PresentationFormat
+  @PresentationFormat
+end
+
+
+
+ + + + +
+

+ + - (Boolean) ScaleCrop + + + +

+
+

+The display mode for the document thumbnail. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +The display mode for the document thumbnail. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+56
+57
+58
+
+
# File 'lib/axlsx/doc_props/app.rb', line 56
+
+def ScaleCrop
+  @ScaleCrop
+end
+
+
+
+ + + + +
+

+ + - (Boolean) ShareDoc + + + +

+
+

+Indicates if the document is shared. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +Indicates if the document is shared. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/axlsx/doc_props/app.rb', line 65
+
+def ShareDoc
+  @ShareDoc
+end
+
+
+
+ + + + +
+

+ + - (Intger) Slides + + + +

+
+

+The number of slides in the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Intger) + + + + — +

    +The number of slides in the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+41
+42
+43
+
+
# File 'lib/axlsx/doc_props/app.rb', line 41
+
+def Slides
+  @Slides
+end
+
+
+
+ + + + +
+

+ + - (String) Template + + + +

+
+

+The name of the document template. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The name of the document template. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/axlsx/doc_props/app.rb', line 14
+
+def Template
+  @Template
+end
+
+
+
+ + + + +
+

+ + - (Integer) TotalTime + + + +

+
+

+The total amount of time spent editing. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The total amount of time spent editing. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/axlsx/doc_props/app.rb', line 47
+
+def TotalTime
+  @TotalTime
+end
+
+
+
+ + + + +
+

+ + - (Integer) Words + + + +

+
+

+The number of words in the document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The number of words in the document. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/axlsx/doc_props/app.rb', line 26
+
+def Words
+  @Words
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) initalize(options = {}) + + + +

+
+

+Creates an App object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + Template + (String) + + + + +
  • + +
  • + Manager + (String) + + + + +
  • + +
  • + Pages + (Integer) + + + + +
  • + +
  • + Words + (Integer) + + + + +
  • + +
  • + Characters + (Integer) + + + + +
  • + +
  • + PresentationFormat + (String) + + + + +
  • + +
  • + Lines + (Integer) + + + + +
  • + +
  • + Paragraphs + (Integer) + + + + +
  • + +
  • + Slides + (Integer) + + + + +
  • + +
  • + Notes + (Integer) + + + + +
  • + +
  • + TotalTime + (Integer) + + + + +
  • + +
  • + HiddenSlides + (Integer) + + + + +
  • + +
  • + MMClips + (Integer) + + + + +
  • + +
  • + ScaleCrop + (Boolean) + + + + +
  • + +
  • + LinksUpToDate + (Boolean) + + + + +
  • + +
  • + CharactersWithSpaces + (Integer) + + + + +
  • + +
  • + ShareDoc + (Boolean) + + + + +
  • + +
  • + HyperLinkBase + (String) + + + + +
  • + +
  • + HyperlinksChanged + (String) + + + + +
  • + +
  • + Application + (String) + + + + +
  • + +
  • + AppVersion + (String) + + + + +
  • + +
  • + DocSecurity + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+105
+106
+107
+108
+109
+
+
# File 'lib/axlsx/doc_props/app.rb', line 105
+
+def initalize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+end
+
+
+
+ +
+

+ + - (String) to_xml + + + +

+
+

+Generate an app.xml document +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The document as a string +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+
+
# File 'lib/axlsx/doc_props/app.rb', line 137
+
+def to_xml()
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.send(:Properties, :xmlns => APP_NS, :'xmlns:vt' => APP_NS_VT) {
+      self.instance_values.each do |name, value|
+        xml.send("ap:#{name}", value)
+      end
+    }
+  end      
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Axis.html b/doc/Axlsx/Axis.html new file mode 100644 index 00000000..ca05fe5f --- /dev/null +++ b/doc/Axlsx/Axis.html @@ -0,0 +1,1047 @@ + + + + + + Class: Axlsx::Axis + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Axis + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/axis.rb
+ +
+
+ +

Overview

+
+

+the access class defines common properties and values for chart axis +

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

CatAxis, ValAxis

+
+ + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Axis) initialize(axId, crossAx, options = {}) + + + +

+
+

+Creates an Axis object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + axId + + + (Integer) + + + + — +

    +the id of this axis +

    +
    + +
  • + +
  • + + crossAx + + + (Integer) + + + + — +

    +the id of the perpendicular axis +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (options):

+
    + +
  • + axPos + (Symbol) + + + + +
  • + +
  • + crosses + (Symbol) + + + + +
  • + +
  • + tickLblPos + (Symbol) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
+
# File 'lib/axlsx/drawing/axis.rb', line 44
+
+def initialize(axId, crossAx, options={})
+  Axlsx::validate_unsigned_int(axId)
+  Axlsx::validate_unsigned_int(crossAx)
+  @axId = axId
+  @crossAx = crossAx
+  self.axPos = :l
+  self.tickLblPos = :nextTo
+  @scaling = Scaling.new(:orientation=>:minMax)
+  @formatCode = ""
+  self.crosses = :autoZero
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Integer) axId (readonly) + + + +

+
+

+the id of the axis +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/drawing/axis.rb', line 8
+
+def axId
+  @axId
+end
+
+
+
+ + + + +
+

+ + - (Symbol) axPos + + + +

+
+

+The position of the axis must be one of [:l, :r, :t, :b] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/axlsx/drawing/axis.rb', line 21
+
+def axPos
+  @axPos
+end
+
+
+
+ + + + +
+

+ + - (Integer) crossAx (readonly) + + + +

+
+

+The perpendicular axis +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/axlsx/drawing/axis.rb', line 12
+
+def crossAx
+  @crossAx
+end
+
+
+
+ + + + +
+

+ + - (Symbol) crosses + + + +

+
+

+specifies how the perpendicular axis is crossed must be one of [:autoZero, +:min, :max] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+36
+37
+38
+
+
# File 'lib/axlsx/drawing/axis.rb', line 36
+
+def crosses
+  @crosses
+end
+
+
+
+ + + + +
+

+ + - (String) format_code + + + +

+
+

+The number format format code for this axis +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/axlsx/drawing/axis.rb', line 31
+
+def format_code
+  @format_code
+end
+
+
+
+ + + + +
+

+ + - (Scaling) scaling (readonly) + + + +

+
+

+The scaling of the axis +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/axlsx/drawing/axis.rb', line 16
+
+def scaling
+  @scaling
+end
+
+
+
+ + + + +
+

+ + - (Symbol) tickLblPos + + + +

+
+

+the position of the tick labels must be one of [:nextTo, :high, :low] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/axlsx/drawing/axis.rb', line 26
+
+def tickLblPos
+  @tickLblPos
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the common axis +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+
+
# File 'lib/axlsx/drawing/axis.rb', line 67
+
+def to_xml(xml)
+  xml.send('c:axId', :val=>@axId)
+  @scaling.to_xml(xml)
+  xml.send('c:axPos', :val=>@axPos)
+  xml.send('c:majorGridlines')
+  xml.send('c:numFmt', :formatCode => @format_code, :sourceLinked=>"1")
+  xml.send('c:tickLblPos', :val=>@tickLblPos)
+  xml.send('c:crossAx', :val=>@crossAx)
+  xml.send('c:crosses', :val=>@crosses)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Bar3DChart.html b/doc/Axlsx/Bar3DChart.html new file mode 100644 index 00000000..da7c952c --- /dev/null +++ b/doc/Axlsx/Bar3DChart.html @@ -0,0 +1,1153 @@ + + + + + + Class: Axlsx::Bar3DChart + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Bar3DChart + + + +

+ +
+ +
Inherits:
+
+ Chart + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/bar_3D_chart.rb
+ +
+
+ +

Overview

+
+

+The Bar3DChart is a three dimentional barchart (who would have guessed?) +that you can add to your worksheet. +

+ + +
+
+
+ +
+

Examples:

+ +

+Creating a chart +

+

+
# This example creates two charts in a single sheet.
+# The first uses data directly fed to the sheet, while the second references cells withing the worksheet for data.
+
+require "rubygems" # if that is your preferred way to manage gems!
+require "axlsx"
+
+p = Axlsx::Package.new
+ws = p.workbook.add_worksheet
+ws.add_row :values => ["This is a chart with no data in the sheet"]
+
+chart = ws.add_chart(Axlsx::Bar3DChart, :start_at=> [0,1], :end_at=>[0,6], :title=>"Most Popular Pets")
+chart.add_series :data => [1, 9, 10], :labels => ["Slimy Reptiles", "Fuzzy Bunnies", "Rottweiler"]
+
+ws.add_row :values => ["This chart uses the data below"]
+title_row = ws.add_row :values => ["Least Popular Pets"]
+label_row = ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"]
+data_row = ws.add_row :values => ["Votes", 6, 4, 1]
+
+chart = ws.add_chart(Axlsx::Pie3DChart, :start_at => [0,11], :end_at =>[0,16], :title => title_row.cells.last)
+chart.add_series :data => data_row.cells[(1..-1)], :labels => label_row.cells  
+
+f = File.open('example_pie_3d_chart.xlsx', 'w')
+p.serialize(f)
+
+ +
+ + +

See Also:

+ + +
+

Constant Summary

+ +
+ +
GAP_AMOUNT_PERCENT = +
+
+

+validation regex for gap amount percent +

+ + +
+
+
+ + +
+
+
/0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
+
+ +
+ + + + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from Chart

+

end_at, graphic_frame, index, pn, series, series_type, show_legend, start_at, title, view3D

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from Chart

+

#add_series

+
+

Constructor Details

+ +
+

+ + - (Bar3DChart) initialize(frame, options = {}) + + + +

+
+

+Creates a new bar chart object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + frame + + + (GraphicFrame) + + + + — +

    +The workbook that owns this chart. +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + title + (Cell, String) + + + + +
  • + +
  • + show_legend + (Boolean) + + + + +
  • + +
  • + barDir + (Symbol) + + + + +
  • + +
  • + grouping + (Symbol) + + + + +
  • + +
  • + gapWidth + (String) + + + + +
  • + +
  • + gapDepth + (String) + + + + +
  • + +
  • + shape + (Symbol) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 79
+
+def initialize(frame, options={})
+  super(frame, options)      
+  @series_type = BarSeries
+  @barDir = :bar
+  @grouping = :clustered
+  @catAxId = rand(8 ** 8)
+  @valAxId = rand(8 ** 8)
+  @catAxis = CatAxis.new(@catAxId, @valAxId)
+  @valAxis = ValAxis.new(@valAxId, @catAxId)
+  @view3D = View3D.new(:rAngAx=>1)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Symbol) barDir + + + +

+
+

+The direction of the bars in the chart must be one of [:bar, :col] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 47
+
+def barDir
+  @barDir
+end
+
+
+
+ + + + +
+

+ + - (CatAxis) catAxis (readonly) + + + +

+
+

+the category axis +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 38
+
+def catAxis
+  @catAxis
+end
+
+
+
+ + + + +
+

+ + - (String) gapDepth + + + +

+
+

+space between bar or column clusters, as a percentage of the bar or column +width. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 51
+
+def gapDepth
+  @gapDepth
+end
+
+
+
+ + + + +
+

+ + - (String) gapWidth + + + +

+
+

+space between bar or column clusters, as a percentage of the bar or column +width. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 55
+
+def gapWidth
+  @gapWidth
+end
+
+
+
+ + + + +
+

+ + - (Symbol) grouping + + + +

+
+

+grouping for a column, line, or area chart. must be one of +[:percentStacked, :clustered, :standard, :stacked] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 60
+
+def grouping
+  @grouping
+end
+
+
+
+ + + + +
+

+ + - (Symbol) shape + + + +

+
+

+The shabe of the bars or columns must be one of [:percentStacked, +:clustered, :standard, :stacked] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 65
+
+def shape
+  @shape
+end
+
+
+
+ + + + +
+

+ + - (ValAxis) valAxis (readonly) + + + +

+
+

+the category axis +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+42
+43
+44
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 42
+
+def valAxis
+  @valAxis
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the bar chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 119
+
+def to_xml
+  super() do |xml|
+    xml.send('c:bar3DChart') {
+      xml.send('c:barDir', :val => barDir)
+      xml.send('c:grouping', :val=>grouping)
+      xml.send('c:varyColors', :val=>1)
+      @series.each { |ser| ser.to_xml(xml) }
+      xml.send('c:gapWidth', :val=>@gapWidth) unless @gapWidth.nil?
+      xml.send('c:gapDepth', :val=>@gapDepth) unless @gapDepth.nil?
+      xml.send('c:shape', :val=>@shape) unless @shape.nil?
+      xml.send('c:axId', :val=>@catAxId)
+      xml.send('c:axId', :val=>@valAxId)
+      xml.send('c:axId', :val=>0)
+    }
+    @catAxis.to_xml(xml)
+    @valAxis.to_xml(xml)        
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/BarSeries.html b/doc/Axlsx/BarSeries.html new file mode 100644 index 00000000..d0f196ee --- /dev/null +++ b/doc/Axlsx/BarSeries.html @@ -0,0 +1,762 @@ + + + + + + Class: Axlsx::BarSeries + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::BarSeries + + + +

+ +
+ +
Inherits:
+
+ Series + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/bar_series.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage series is to use Chart#add_series +

+
+
+ +

+A BarSeries defines the title, data and labels for bar charts +

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from Series

+

chart, index, order, title

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + +
+

Constructor Details

+ +
+

+ + - (BarSeries) initialize(chart, options = {}) + + + +

+
+

+Creates a new series +

+ + +
+
+
+

Parameters:

+
    + +
  • + + chart + + + (Chart) + + + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + data + (Array, SimpleTypedList) + + + + +
  • + +
  • + labels + (Array, SimpleTypedList) + + + + +
  • + +
  • + title + (String) + + + + +
  • + +
  • + shape + (String) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/axlsx/drawing/bar_series.rb', line 28
+
+def initialize(chart, options={})
+  @shape = :box
+  super(chart, options)
+  self.data = options[:data]  || []
+  self.labels = options[:labels] || []
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Array, SimpleTypedList) data + + + +

+
+

+The data for this series. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/drawing/bar_series.rb', line 11
+
+def data
+  @data
+end
+
+
+
+ + + + +
+

+ + - (Array, SimpleTypedList) labels + + + +

+
+

+The labels for this series. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/axlsx/drawing/bar_series.rb', line 15
+
+def labels
+  @labels
+end
+
+
+
+ + + + +
+

+ + - (Symbol) shape + + + +

+
+

+The shabe of the bars or columns must be one of [:percentStacked, +:clustered, :standard, :stacked] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/axlsx/drawing/bar_series.rb', line 20
+
+def shape
+  @shape
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the series +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+
+
# File 'lib/axlsx/drawing/bar_series.rb', line 43
+
+def to_xml(xml)
+  super(xml) do |xml|
+    if !labels.empty?
+      xml.send('c:cat') {
+        xml.send('c:strRef') {
+          xml.send('c:f', Axlsx::cell_range(labels))
+          xml.send('c:strCache') {
+            xml.send('c:ptCount', :val=>labels.size)
+            labels.each_with_index do |cell, index|
+              v = cell.is_a?(Cell) ? cell.value : cell
+              xml.send('c:pt', :idx=>index) {
+                xml.send('c:v', v)
+              }                          
+            end
+          }
+        }
+      }
+    end
+    xml.send('c:val') {
+      xml.send('c:numRef') {
+        xml.send('c:f', Axlsx::cell_range(data))
+        xml.send('c:numCache') {
+          xml.send('c:formatCode', 'General')
+          xml.send('c:ptCount', :val=>data.size)
+          data.each_with_index do |cell, index|
+            v = cell.is_a?(Cell) ? cell.value : cell
+            xml.send('c:pt', :idx=>index) {
+              xml.send('c:v', v) 
+            }
+          end
+        }                        
+      }
+    }
+  end      
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Border.html b/doc/Axlsx/Border.html new file mode 100644 index 00000000..413ee9c1 --- /dev/null +++ b/doc/Axlsx/Border.html @@ -0,0 +1,775 @@ + + + + + + Class: Axlsx::Border + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Border + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/border.rb
+ +
+
+ +

Overview

+
+

+This class details a border used in Office Open XML spreadsheet styles. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Border) initialize(options = {}) + + + +

+
+

+Creates a new Border object +

+ + +
+
+
+ +
+

Examples:

+ +

+Making a border +

+

+
p = Package.new
+red_border = Border.new
+[:left, :right, :top, :bottom].each do |item| 
+  red_border.prs << BorderPr.new(:name=>item, :style=>:thin, :color=>Color.new(:rgb=>"FFFF0000"))     #   
+end
+# this sets red_border to be the index for the created border.
+red_border = p.workbook.styles.@borders << red_border
+#used in row creation as follows. This will add a red border to each of the cells in the row.
+p.workbook.add_worksheet.rows << :values=>[1,2,3] :style=>red_border
+
+ +
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + diagonalUp + (Boolean) + + + + +
  • + +
  • + diagonalDown + (Boolean) + + + + +
  • + +
  • + outline + (Boolean) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+31
+32
+33
+34
+35
+36
+
+
# File 'lib/axlsx/stylesheet/border.rb', line 31
+
+def initialize(options={})
+  @prs = SimpleTypedList.new BorderPr
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Boolean) diagonalDown + + + +

+
+

+The diagonal down property for the border that indicates if the border +should include a diagonal line from the top left to the top right of the +cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +The diagonal down property for the border that indicates if the border +should include a diagonal line from the top left to the top right of the +cell. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/stylesheet/border.rb', line 9
+
+def diagonalDown
+  @diagonalDown
+end
+
+
+
+ + + + +
+

+ + - (Boolean) diagonalUp + + + +

+
+

+The diagonal up property for the border that indicates if the border should +include a diagonal line from the bottom left to the top right of the cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +The diagonal up property for the border that indicates if the border should +include a diagonal line from the bottom left to the top right of the cell. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/axlsx/stylesheet/border.rb', line 6
+
+def diagonalUp
+  @diagonalUp
+end
+
+
+
+ + + + +
+

+ + - (Boolean) outline + + + +

+
+

+The outline property for the border indicating that top, left, right and +bottom borders should only be applied to the outside border of a range of +cells. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +The outline property for the border indicating that top, left, right and +bottom borders should only be applied to the outside border of a range of +cells. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/axlsx/stylesheet/border.rb', line 12
+
+def outline
+  @outline
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) prs (readonly) + + + +

+
+

+A list of BorderPr objects for this border. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (SimpleTypedList) + + + + — +

    +A list of BorderPr objects for this border. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/axlsx/stylesheet/border.rb', line 15
+
+def prs
+  @prs
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) to_xml(xml) + + + +

+
+

+Serializes the border element +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/axlsx/stylesheet/border.rb', line 44
+
+def to_xml(xml)
+  xml.border(self.instance_values.select{ |k,v| [:diagonalUp, :diagonalDown, :outline].include? k }) {
+    [:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal].each do |k|
+      @prs.select { |pr| pr.name == k }.each { |pr| pr.to_xml(xml) }
+    end
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/BorderPr.html b/doc/Axlsx/BorderPr.html new file mode 100644 index 00000000..72d6b7a0 --- /dev/null +++ b/doc/Axlsx/BorderPr.html @@ -0,0 +1,709 @@ + + + + + + Class: Axlsx::BorderPr + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::BorderPr + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/border_pr.rb
+ +
+
+ +

Overview

+
+

+A border part. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (BorderPr) initialize(options = {}) + + + +

+
+

+Creates a new Border Part Object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + color + (Color) + + + + +
  • + +
  • + name + (Symbol) + + + + +
  • + +
  • + style + (Symbol) + + + + +
  • + +
+ + + +

See Also:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+
+
# File 'lib/axlsx/stylesheet/border_pr.rb', line 46
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Color) color + + + +

+
+

+The color of this border part. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Color) + + + + — +

    +The color of this border part. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/axlsx/stylesheet/border_pr.rb', line 6
+
+def color
+  @color
+end
+
+
+
+ + + + +
+

+ + - (Symbol) name + + + +

+
+ +
+ Note: +

+The following are allowed +

+
+ :start
+ :end
+ :left
+ :right
+ :top
+ :bottom
+ :diagonal
+ :vertical
+ :horizontal
+
+
+
+ +

+The name of this border part +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +

    +The name of this border part +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+
+
# File 'lib/axlsx/stylesheet/border_pr.rb', line 39
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Symbol) style + + + +

+
+ +
+ Note: +

+The following are allowed +

+
+ :none
+ :thin
+ :medium
+ :dashed
+ :dotted
+ :thick
+ :double
+ :hair
+ :mediumDashed
+ :dashDot
+ :mediumDashDot
+ :dashDotDot
+ :mediumDashDotDot
+ :slantDashDot
+
+
+
+ +

+The syle of this border part. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +

    +The syle of this border part. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/axlsx/stylesheet/border_pr.rb', line 25
+
+def style
+  @style
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the border part +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+62
+63
+
+
# File 'lib/axlsx/stylesheet/border_pr.rb', line 59
+
+def to_xml(xml)
+  xml.send(@name, :style=>@style) {
+    @color.to_xml(xml) if @color.is_a? Color
+  } 
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/CatAxis.html b/doc/Axlsx/CatAxis.html new file mode 100644 index 00000000..235e4a50 --- /dev/null +++ b/doc/Axlsx/CatAxis.html @@ -0,0 +1,766 @@ + + + + + + Class: Axlsx::CatAxis + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::CatAxis + + + +

+ +
+ +
Inherits:
+
+ Axis + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/cat_axis.rb
+ +
+
+ +

Overview

+
+

+A CatAxis object defines a chart category axis +

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
LBL_OFFSET_REGEX = +
+
+

+regex for validating label offset +

+ + +
+
+
+ + +
+
+
/0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)%/
+
+ +
+ + + + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from Axis

+

axId, axPos, crossAx, crosses, format_code, scaling, tickLblPos

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + +
+

Constructor Details

+ +
+

+ + - (CatAxis) initialize(axId, crossAx, options = {}) + + + +

+
+

+Creates a new CatAxis object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + axId + + + (Integer) + + + + — +

    +the id of this axis +

    +
    + +
  • + +
  • + + crossAx + + + (Integer) + + + + — +

    +the id of the perpendicular axis +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (options):

+
    + +
  • + axPos + (Symbol) + + + + +
  • + +
  • + tickLblPos + (Symbol) + + + + +
  • + +
  • + crosses + (Symbol) + + + + +
  • + +
  • + auto + (Boolean) + + + + +
  • + +
  • + lblAlgn + (Symbol) + + + + +
  • + +
  • + lblOffset + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+
+
# File 'lib/axlsx/drawing/cat_axis.rb', line 30
+
+def initialize(axId, crossAx, options={})
+  super(axId, crossAx, options)
+  self.auto = true
+  self.lblAlgn = :ctr
+  self.lblOffset = "100%"
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Boolean) auto + + + +

+
+

+From the docs: This element specifies that this axis is a date or text axis +based on the data that is used for the axis labels, not a specific choice. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/axlsx/drawing/cat_axis.rb', line 6
+
+def auto
+  @auto
+end
+
+
+
+ + + + +
+

+ + - (Symbol) lblAlgn + + + +

+
+

+specifies how the perpendicular axis is crossed must be one of [:ctr, :l, +:r] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/drawing/cat_axis.rb', line 11
+
+def lblAlgn
+  @lblAlgn
+end
+
+
+
+ + + + +
+

+ + - (Integer) lblOffset + + + +

+
+

+The offset of the labels must be between a string between 0 and 1000 +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/axlsx/drawing/cat_axis.rb', line 16
+
+def lblOffset
+  @lblOffset
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the category axis +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+50
+51
+52
+53
+54
+
+
# File 'lib/axlsx/drawing/cat_axis.rb', line 47
+
+def to_xml(xml)
+  xml.send('c:catAx') {
+    super(xml)
+    xml.send('c:auto', :val=>@auto)
+    xml.send('c:lblAlgn', :val=>@lblAlgn)
+    xml.send('c:lblOffset', :val=>@lblOffset)                 
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Cell.html b/doc/Axlsx/Cell.html new file mode 100644 index 00000000..3dfc11f1 --- /dev/null +++ b/doc/Axlsx/Cell.html @@ -0,0 +1,1623 @@ + + + + + + Class: Axlsx::Cell + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Cell + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/workbook/worksheet/cell.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to generate cells is via Worksheet#add_row +

+
+
+ +

+A cell in a worksheet. Cell stores inforamation requried to serialize a +single worksheet cell to xml. You must provde the Row that the cell belongs +to and the cells value. The data type will automatically be determed if you +do not specify the :type option. The default style will be applied if you +do not supply the :style option. Changing the cell’s type will recast +the value to the type specified. Altering the cell’s value via the +property accessor will also automatically cast the provided value to the +cell’s type. +

+ + +
+
+
+ +
+

Examples:

+ +

+Manually creating and manipulating Cell objects +

+

+
ws = Workbook.new.add_worksheet 
+# This is the simple, and recommended way to create cells. Data types will automatically be determined for you.
+ws.add_row :values => [1,"fish",Time.now]
+
+# but you can also do this
+r = ws.add_row
+r.add_cell 1
+
+# or even this
+r = ws.add_row
+c = Cell.new row, 1, :value=>integer
+
+# cells can also be accessed via Row#cells. The example here changes the cells type, which will automatically updated the value from 1 to 1.0
+r.cells.last.type = :float
+
+ +
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Cell) initialize(row, value = "", options = {}) + + + +

+
+

+A new instance of Cell +

+ + +
+
+
+

Parameters:

+
    + +
  • + + row + + + (Row) + + + + — +

    +The row this cell belongs to. +

    +
    + +
  • + +
  • + + value + + + (Any) + + + (defaults to: "") + + + — +

    +The value associated with this cell. +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (options):

+
    + +
  • + type + (Symbol) + + + + —

    +The intended data type for this cell. If not specified the data type will +be determined internally based on the vlue provided. +

    +
    +
  • + +
  • + style + (Integer) + + + + —

    +The index of the cellXfs item to be applied to this cell. If not specified, +the default style (0) will be applied. +

    +
    +
  • + +
+ + + +
+ + + + +
+
+
+
+56
+57
+58
+59
+60
+61
+62
+63
+64
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 56
+
+def initialize(row, value="", options={})
+  self.row=row
+  #reference for validation
+  @styles = row.worksheet.workbook.styles
+  @type= options[:type] || cell_type_from_value(value)
+  self.style = options[:style] || 0 
+  @value = cast_value(value)
+  @row.cells << self
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Row) row + + + +

+
+

+The row this cell belongs to. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Row) + + + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 32
+
+def row
+  @row
+end
+
+
+
+ + + + +
+

+ + - (Integer) style + + + +

+
+

+The index of the cellXfs item to be applied to this cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 28
+
+def style
+  @style
+end
+
+
+
+ + + + +
+

+ + - (Symbol) type + + + +

+
+ +
+ Note: +

+If the value provided cannot be cast into the type specified, type is +changed to :string and the following logic is applied. +

+
+ :string to :integer or :float, type coversions always return 0 or 0.0
+ :string, :integer, or :float to :time conversions always return the original value as a string and set the cells type to :string.
+
+

+No support is currently implemented for parsing time strings. +

+
+
+ +

+The cell’s data type. Currently only four types are supported, :time, +:float, :integer and :string. Changing the type for a cell will recast the +value into that type. If no type option is specified in the constructor, +the type is automatically determed. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +

    +The type of data this cell’s value is cast to. +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentExeption) + + + + — +

    +Cell.type must be one of [:time, :float, :integer, :string] +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 46
+
+def type
+  @type
+end
+
+
+
+ + + + +
+

+ + - (Object) value + + + +

+
+

+The value of this cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + + + + + +

    +casted value based on cell’s type attribute. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 50
+
+def value
+  @value
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) cast_value(v) + + + +

+
+ +
+ Note: +

+About Time - Time in OOXML is different from what you might expect. +The history as to why is interesting, but you can safely assume that if you +are generating docs on a mac, you will want to specify Workbook.1904 as +true when using time typed values. +

+
+
+ +

+Cast the value into this cells data type. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Axlsx#date1904
  • + +
+ +
+ + + + +
+
+
+
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 160
+
+def cast_value(v)
+  if @type == :time && v.is_a?(Time)
+    #todo consider a time parsing method to convert strings to time
+    epoc = Workbook.date1904 ? Time.local(1904,1,1,0,0,0,0,v.zone) : Time.local(1900,1,1,0,0,0,0,v.zone)
+    ((v - epoc) /60.0/60.0/24.0).to_f
+  elsif @type == :float
+    v.to_f
+  elsif @type == :integer
+    v.to_i
+  else
+    @type = :string
+    v.to_s
+    # curious as to why this would be the cells responsibility
+    # convert your values before passing them in wankers! CGI.unescapeHTML(v.to_s).to_xs
+    # to revert, load this once when the gem is loaded.
+    # unless String.method_defined? :to_xs
+    #   require 'fast_xs' #dep
+    #   class String
+    #     alias_method :to_xs, :fast_xs
+    #   end
+    # end
+  end
+end
+
+
+
+ +
+

+ + - (Symbol) cell_type_from_value(v) + + + +

+
+ +
+ Note: +

+This is only used when a cell is created but no :type option is specified, +the following rules apply: +

+
    +
  1. If the value is an instance of Time, the type is set to :time + +
  2. +
  3. :float and :integer types are determined by regular expression matching. + +
  4. +
  5. Anything that does not meet either of the above is determined to be +:string. + +
  6. +
+
+
+ +

+Determines the cell type based on the cell value. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +

    +The determined type +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 144
+
+def cell_type_from_value(v)      
+  if v.is_a? Time
+    :time
+  elsif v.to_s.match(/\A[+-]?\d+?\Z/) #numeric
+    :integer
+  elsif v.to_s.match(/\A[+-]?\d+\.\d+?\Z/) #float
+    :float
+  else
+    :string
+  end
+end
+
+
+
+ +
+

+ + - (String) col_ref + + + +

+
+ +
+ Note: +

+This follows the standard spreadsheet convention of naming columns A to Z, +followed by AA to AZ etc. +

+
+
+ +

+converts the column index into alphabetical values. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 127
+
+def col_ref
+    chars = []
+    index = self.index
+    while index >= 26 do
+      chars << ((index % 26) + 65).chr
+      index /= 26
+    end
+    chars << ((chars.empty? ? index : index-1) + 65).chr
+    chars.reverse.join
+  end
+
+  # Determines the cell type based on the cell value. 
+  # @note This is only used when a cell is created but no :type option is specified, the following rules apply:
+  #   1. If the value is an instance of Time, the type is set to :time
+  #   2. :float and :integer types are determined by regular expression matching.
+  #   3. Anything that does not meet either of the above is determined to be :string.
+  # @return [Symbol] The determined type
+  def cell_type_from_value(v)      
+    if v.is_a? Time
+      :time
+    elsif v.to_s.match(/\A[+-]?\d+?\Z/) #numeric
+      :integer
+    elsif v.to_s.match(/\A[+-]?\d+\.\d+?\Z/) #float
+      :float
+    else
+      :string
+    end
+  end
+
+  # Cast the value into this cells data type. 
+  # @note 
+  #   About Time - Time in OOXML is *different* from what you might expect. The history as to why is interesting,  but you can safely assume that if you are generating docs on a mac, you will want to specify Workbook.1904 as true when using time typed values.
+  # @see Axlsx#date1904
+  def cast_value(v)
+    if @type == :time && v.is_a?(Time)
+      #todo consider a time parsing method to convert strings to time
+      epoc = Workbook.date1904 ? Time.local(1904,1,1,0,0,0,0,v.zone) : Time.local(1900,1,1,0,0,0,0,v.zone)
+      ((v - epoc) /60.0/60.0/24.0).to_f
+    elsif @type == :float
+      v.to_f
+    elsif @type == :integer
+      v.to_i
+    else
+      @type = :string
+      v.to_s
+      # curious as to why this would be the cells responsibility
+      # convert your values before passing them in wankers! CGI.unescapeHTML(v.to_s).to_xs
+      # to revert, load this once when the gem is loaded.
+      # unless String.method_defined? :to_xs
+      #   require 'fast_xs' #dep
+      #   class String
+      #     alias_method :to_xs, :fast_xs
+      #   end
+      # end
+    end
+  end    
+end
+
+
+
+ +
+

+ + - (Integer) index + + + +

+
+

+The index of the cell in the containing row. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +The index of the cell in the containing row. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+67
+68
+69
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 67
+
+def index
+  @row.cells.index(self)
+end
+
+
+
+ +
+

+ + - (String) r + + + +

+
+

+The alpha(column)numeric(row) reference for this sell. +

+ + +
+
+
+ +
+

Examples:

+ +

+Relative Cell Reference +

+

+
ws.rows.first.cells.first.r #=> "A1" 
+
+ +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The alpha(column)numeric(row) reference for this sell. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 74
+
+def r
+  "#{col_ref}#{@row.index+1}"      
+end
+
+
+
+ +
+

+ + - (String) r_abs + + + +

+
+

+The absolute alpha(column)numeric(row) reference for this sell. +

+ + +
+
+
+ +
+

Examples:

+ +

+Absolute Cell Reference +

+

+
ws.rows.first.cells.first.r #=> "$A$1" 
+
+ +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The absolute alpha(column)numeric(row) reference for this sell. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+81
+82
+83
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 81
+
+def r_abs
+  "$#{r.split('').join('$')}"
+end
+
+
+
+ +
+

+ + - (String) to_xml(xml) + + + +

+
+ +
+ Note: +

+Shared Strings are not used in this library. All values are set directly in +the each sheet. +

+
+
+ +

+Serializes the cell +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +xml text for the cell +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+110
+111
+112
+113
+114
+115
+116
+117
+
+
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 110
+
+def to_xml(xml)
+  if @type == :string
+    #NOTE not sure why, but xml.t @v renders the text as html entities of unicode data
+    xml.c(:r => r, :t=>:inlineStr, :s=>style) { xml.is { xml << "<t>#{value}</t>" } }
+  else
+    xml.c(:r => r, :s => style) { xml.v value }
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/CellAlignment.html b/doc/Axlsx/CellAlignment.html new file mode 100644 index 00000000..a541eb5e --- /dev/null +++ b/doc/Axlsx/CellAlignment.html @@ -0,0 +1,1247 @@ + + + + + + Class: Axlsx::CellAlignment + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::CellAlignment + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/cell_alignment.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Using Styles#add_style is the recommended way to manage cell alignment. +

+
+
+ +

+CellAlignment stores information about the cell alignment of a style Xf +Object. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (CellAlignment) initialize(options = {}) + + + +

+
+

+Create a new cell_alignment object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + horizontal + (Symbol) + + + + +
  • + +
  • + vertical + (Symbol) + + + + +
  • + +
  • + textRotation + (Integer) + + + + +
  • + +
  • + wrapText + (Boolean) + + + + +
  • + +
  • + indent + (Integer) + + + + +
  • + +
  • + relativeIndent + (Integer) + + + + +
  • + +
  • + justifyLastLine + (Boolean) + + + + +
  • + +
  • + shrinkToFit + (Boolean) + + + + +
  • + +
  • + readingOrder + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+72
+73
+74
+75
+76
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 72
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Symbol) horizontal + + + +

+
+ +
+ Note: +

+The horizontal cell alignement style must be one of +

+
+ :general
+ :left
+ :center
+ :right
+ :fill
+ :justify
+ :centerContinuous
+ :distributed
+
+
+
+ +

+The horizontal alignment of the cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 18
+
+def horizontal
+  @horizontal
+end
+
+
+
+ + + + +
+

+ + - (Integer) indent + + + +

+
+

+The amount of indent +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+41
+42
+43
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 41
+
+def indent
+  @indent
+end
+
+
+
+ + + + +
+

+ + - (Boolean) justifyLastLine + + + +

+
+

+Indicate if the last line should be justified. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 49
+
+def justifyLastLine
+  @justifyLastLine
+end
+
+
+
+ + + + +
+

+ + - (Integer) readingOrder + + + +

+
+

+The reading order of the text 0 Context Dependent 1 Left-to-Right 2 +Right-to-Left +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 60
+
+def readingOrder
+  @readingOrder
+end
+
+
+
+ + + + +
+

+ + - (Integer) relativeIndent + + + +

+
+

+The amount of relativeIndent +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+45
+46
+47
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 45
+
+def relativeIndent
+  @relativeIndent
+end
+
+
+
+ + + + +
+

+ + - (Boolean) shrinkToFit + + + +

+
+

+Indicate if the text should be shrunk to the fit in the cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+53
+54
+55
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 53
+
+def shrinkToFit
+  @shrinkToFit
+end
+
+
+
+ + + + +
+

+ + - (Integer) textRotation + + + +

+
+

+The textRotation of the cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 33
+
+def textRotation
+  @textRotation
+end
+
+
+
+ + + + +
+

+ + - (Symbol) vertical + + + +

+
+ +
+ Note: +

+The vertical cell allingment style must be one of the following: +

+
+ :top
+ :center
+ :bottom
+ :justify
+ :distributed
+
+
+
+ +

+The vertical alignment of the cell. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 29
+
+def vertical
+  @vertical
+end
+
+
+
+ + + + +
+

+ + - (Boolean) wrapText + + + +

+
+

+Indicate if the text of the cell should wrap +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 37
+
+def wrapText
+  @wrapText
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the cell alignment +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 91
+
+def to_xml(xml)
+  xml.alignment(self.instance_values)      
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/CellProtection.html b/doc/Axlsx/CellProtection.html new file mode 100644 index 00000000..345e3e09 --- /dev/null +++ b/doc/Axlsx/CellProtection.html @@ -0,0 +1,565 @@ + + + + + + Class: Axlsx::CellProtection + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::CellProtection + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/cell_protection.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Using Styles#add_style is the recommended way to manage cell protection. +

+
+
+ +

+CellProtection stores information about locking or hiding cells in +spreadsheet. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (CellProtection) initialize(options = {}) + + + +

+
+

+Creates a new CellProtection +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + hidden + (Boolean) + + + + —

    +value for hidden protection +

    +
    +
  • + +
  • + locked + (Boolean) + + + + —

    +value for locked protection +

    +
    +
  • + +
+ + + +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+
+
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 18
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Boolean) hidden + + + +

+
+

+specifies locking for cells that have the style containing this protection +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 9
+
+def 
+  @hidden
+end
+
+
+
+ + + + +
+

+ + - (Boolean) locked + + + +

+
+

+specifies if the cells that have the style containing this protection +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 13
+
+def locked
+  @locked
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the cell protection +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/axlsx/stylesheet/cell_protection.rb', line 29
+
+def to_xml(xml)
+  xml.protection(self.instance_values)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/CellStyle.html b/doc/Axlsx/CellStyle.html new file mode 100644 index 00000000..042069c9 --- /dev/null +++ b/doc/Axlsx/CellStyle.html @@ -0,0 +1,949 @@ + + + + + + Class: Axlsx::CellStyle + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::CellStyle + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/cell_style.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Using Styles#add_style is the recommended way to manage cell styling. +

+
+
+ +

+CellStyle defines named styles that reference defined formatting records +and can be used in your worksheet. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (CellStyle) initialize(options = {}) + + + +

+
+

+Creats a new CellStyle object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + name + (String) + + + + +
  • + +
  • + xfId + (Integer) + + + + +
  • + +
  • + buildinId + (Integer) + + + + +
  • + +
  • + iLevel + (Integer) + + + + +
  • + +
  • + hidden + (Boolean) + + + + +
  • + +
  • + customBuiltIn + (Boolean) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+39
+40
+41
+42
+43
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 39
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Integer) builtinId + + + +

+
+

+The buildinId to use when this named style is applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 18
+
+def builtinId
+  @builtinId
+end
+
+
+
+ + + + +
+

+ + - (Boolean) customBuiltin + + + +

+
+

+Indicates that the build in style reference has been customized. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 30
+
+def customBuiltin
+  @customBuiltin
+end
+
+
+
+ + + + +
+

+ + - (Boolean) hidden + + + +

+
+

+Determines if this named style should show in the list of styles when using +excel +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 26
+
+def 
+  @hidden
+end
+
+
+
+ + + + +
+

+ + - (Integer) iLevel + + + +

+
+

+Determines if this formatting is for an outline style, and what level of +the outline it is to be applied to. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 22
+
+def iLevel
+  @iLevel
+end
+
+
+
+ + + + +
+

+ + - (String) name + + + +

+
+

+The name of this cell style +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 8
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Integer) xfId + + + +

+
+

+The formatting record id this named style utilizes +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +

See Also:

+
    + +
  • Xf
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 13
+
+def xfId
+  @xfId
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the cell style +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/axlsx/stylesheet/cell_style.rb', line 55
+
+def to_xml(xml)
+  xml.cellStyle(self.instance_values)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Chart.html b/doc/Axlsx/Chart.html new file mode 100644 index 00000000..ee2c89d7 --- /dev/null +++ b/doc/Axlsx/Chart.html @@ -0,0 +1,1369 @@ + + + + + + Class: Axlsx::Chart + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Chart + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/chart.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Worksheet#add_chart is the recommended way to create charts for your +worksheets. +

+
+
+ +

+A Chart is the superclass for specific charts +

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

Bar3DChart, Pie3DChart

+
+ + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Chart) initialize(frame, options = {}) {|_self| ... } + + + +

+
+

+Creates a new chart object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + frame + + + (GraphicalFrame) + + + + — +

    +The frame that holds this chart. +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + title + (Cell, String) + + + + +
  • + +
  • + show_legend + (Boolean) + + + + +
  • + +
+ + +

Yields:

+
    + +
  • + + + (_self) + + + +
  • + +
+

Yield Parameters:

+
    + +
  • + + _self + + + (Axlsx::Chart) + + + + — +

    +the object that the method was called on +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/axlsx/drawing/chart.rb', line 52
+
+def initialize(frame, options={})
+  @graphic_frame=frame
+  @graphic_frame.anchor.drawing.worksheet.workbook.charts << self
+  @series = SimpleTypedList.new Series
+  @show_legend = true
+  @series_type = Series
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+  yield self if block_given?
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Marker) end_at + + + +

+
+

+The ending marker for this chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Marker) + + + +
  • + +
+ +
+ + + + +
+
+
+
+42
+43
+44
+
+
# File 'lib/axlsx/drawing/chart.rb', line 42
+
+def end_at
+  @end_at
+end
+
+
+
+ + + + +
+

+ + - (GraphicFrame) graphic_frame (readonly) + + + +

+
+

+A reference to the graphic frame that owns this chart +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/axlsx/drawing/chart.rb', line 15
+
+def graphic_frame
+  @graphic_frame
+end
+
+
+
+ + + + +
+

+ + - (Integer) index (readonly) + + + +

+
+

+The index of this chart in the workbooks charts collection +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/axlsx/drawing/chart.rb', line 27
+
+def index
+  @graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self)
+end
+
+
+
+ + + + +
+

+ + - (String) pn (readonly) + + + +

+
+

+The part name for this chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/axlsx/drawing/chart.rb', line 31
+
+def pn
+  "#{CHART_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) series (readonly) + + + +

+
+

+A collection of series objects that are applied to the chart +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/axlsx/drawing/chart.rb', line 19
+
+def series
+  @series
+end
+
+
+
+ + + + +
+

+ + - (Series) series_type (readonly) + + + +

+
+

+The type of series to use for this chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Series) + + + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/axlsx/drawing/chart.rb', line 23
+
+def series_type
+  @series_type
+end
+
+
+
+ + + + +
+

+ + - (Boolean) show_legend + + + +

+
+

+Show the legend in the chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/axlsx/drawing/chart.rb', line 46
+
+def show_legend
+  @show_legend
+end
+
+
+
+ + + + +
+

+ + - (Marker) start_at + + + +

+
+

+The starting marker for this chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Marker) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/drawing/chart.rb', line 38
+
+def start_at
+  @start_at
+end
+
+
+
+ + + + +
+

+ + - (Title) title + + + +

+
+

+The title object for the chart. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Title) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/drawing/chart.rb', line 8
+
+def title
+  @title
+end
+
+
+
+ + + + +
+

+ + - (Object) view3D + + + +

+
+

+The 3D view properties for the chart +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/drawing/chart.rb', line 11
+
+def view3D
+  @view3D
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Series) add_series(options = {}) + + + +

+
+

+Adds a new series to the chart’s series collection. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Series) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+85
+86
+87
+88
+
+
# File 'lib/axlsx/drawing/chart.rb', line 85
+
+def add_series(options={})
+  @series_type.new(self, options)
+  @series.last
+end
+
+
+
+ +
+

+ + - (Object) to_xml + + + +

+
+

+Chart Serialization serializes the chart +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+
+
# File 'lib/axlsx/drawing/chart.rb', line 92
+
+def to_xml
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.send('c:chartSpace',:'xmlns:c' => XML_NS_C, :'xmlns:a' => XML_NS_A) {
+      xml.send('c:chart') {
+        @title.to_xml(xml) unless @title.nil?
+        @view3D.to_xml(xml) unless @view3D.nil?
+        xml.send('c:plotArea') {
+          xml.send('c:layout')
+          yield xml if block_given?
+        }
+        if @show_legend
+          xml.send('c:legend') {
+            xml.send('c:legendPos', :val => "r")
+            xml.send('c:layout')
+          }
+        end
+      }
+    }
+  end
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Color.html b/doc/Axlsx/Color.html new file mode 100644 index 00000000..f73dc256 --- /dev/null +++ b/doc/Axlsx/Color.html @@ -0,0 +1,665 @@ + + + + + + Class: Axlsx::Color + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Color + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/color.rb
+ +
+
+ +

Overview

+
+

+The color class represents a color used for borders, fills an fonts +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Color) initialize(options = {}) + + + +

+
+

+Creates a new Color object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + auto + (Boolean) + + + + +
  • + +
  • + rgb + (String) + + + + +
  • + +
  • + tint + (Float) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+34
+35
+36
+37
+38
+39
+
+
# File 'lib/axlsx/stylesheet/color.rb', line 34
+
+def initialize(options={})
+  @rgb = "FF000000"
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Boolean) auto + + + +

+
+

+Determines if the color is system color dependant +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/axlsx/stylesheet/color.rb', line 6
+
+def auto
+  @auto
+end
+
+
+
+ + + + +
+

+ + - (String) rgb + + + +

+
+ +
+ Note: +

+rgb colors need to conform to ST_UnsignedIntHex. That basically means put +‘FF’ before you color +

+
+
+ +

+The color as defined in rgb terms. +

+ + +
+
+
+ +
+

Examples:

+ +

+rgb colors +

+

+
"FF000000" is black
+"FFFFFFFF" is white
+
+ +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/axlsx/stylesheet/color.rb', line 19
+
+def rgb
+  @rgb
+end
+
+
+
+ + + + +
+

+ + - (Float) tint + + + +

+
+ +
+ Note: +

+valid values are between -1.0 and 1.0 +

+
+
+ +

+The tint value. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/axlsx/stylesheet/color.rb', line 28
+
+def tint
+  @tint
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the color +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+
+
# File 'lib/axlsx/stylesheet/color.rb', line 55
+
+def to_xml(xml) xml.color(self.instance_values) end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/ContentType.html b/doc/Axlsx/ContentType.html new file mode 100644 index 00000000..ab1ccff9 --- /dev/null +++ b/doc/Axlsx/ContentType.html @@ -0,0 +1,340 @@ + + + + + + Class: Axlsx::ContentType + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::ContentType + + + +

+ +
+ +
Inherits:
+
+ SimpleTypedList + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/content_type/content_type.rb
+ +
+
+ +

Overview

+
+

+ContentTypes used in the package. This is automatcially managed by the +package package. +

+ + +
+
+
+ + +
+ + + + + + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from SimpleTypedList

+

allowed_types, locked_at, serialize_as

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from SimpleTypedList

+

#<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

+
+

Constructor Details

+ +
+

+ + - (ContentType) initialize + + + +

+
+

+A new instance of ContentType +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/content_type/content_type.rb', line 8
+
+def initialize
+  super [Override, Default]
+end
+
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class Axlsx::SimpleTypedList + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml + + + +

+
+

+Generates the xml document for [Content_Types].xml +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The document as a string. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+14
+15
+16
+17
+18
+19
+20
+21
+
+
# File 'lib/axlsx/content_type/content_type.rb', line 14
+
+def to_xml()
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.Types(:xmlns => Axlsx::XML_NS_T) {
+      each { |type| type.to_xml(xml) }
+    }
+  end
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Core.html b/doc/Axlsx/Core.html new file mode 100644 index 00000000..ab5ae902 --- /dev/null +++ b/doc/Axlsx/Core.html @@ -0,0 +1,465 @@ + + + + + + Class: Axlsx::Core + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Core + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/doc_props/core.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Packages manage their own core object. +

+
+
+ +

+The core object for the package. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Package#core
  • + +
+ +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Core) initialize(options = {}) + + + +

+
+

+Creates a new Core object. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + creator + (String) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/axlsx/doc_props/core.rb', line 12
+
+def initialize(options={})
+  @creator = options[:creator] || 'axlsx'      
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) creator + + + +

+
+

+The author of the document. By default this is ‘axlsx’ +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/doc_props/core.rb', line 8
+
+def creator
+  @creator
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the core object. The created dcterms item is set to the current +time when this method is called. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+
+
# File 'lib/axlsx/doc_props/core.rb', line 18
+
+def to_xml()
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.send('cp:coreProperties', 
+             :"xmlns:cp" => CORE_NS, 
+             :'xmlns:dc' => CORE_NS_DC, 
+             :'xmlns:dcmitype'=>CORE_NS_DCMIT, 
+             :'xmlns:dcterms'=>CORE_NS_DCT, 
+             :'xmlns:xsi'=>CORE_NS_XSI) {
+      xml['dc'].creator self.creator
+      xml['dcterms'].created Time.now.strftime('%Y-%m-%dT%H:%M:%S'), :'xsi:type'=>"dcterms:W3CDTF"
+      xml['cp'].revision 0
+    }
+  end  
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/DataTypeValidator.html b/doc/Axlsx/DataTypeValidator.html new file mode 100644 index 00000000..2dc7891f --- /dev/null +++ b/doc/Axlsx/DataTypeValidator.html @@ -0,0 +1,324 @@ + + + + + + Class: Axlsx::DataTypeValidator + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::DataTypeValidator + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/util/validators.rb
+ +
+
+ +

Overview

+
+

+Validate that the class of the value provided is either an instance or the +class of the allowed types and that any specified additional validation +returns true. +

+ + +
+
+
+ + +
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Boolean) validate(name, types, v, other = lambda{|v| true }) + + + +

+
+

+Perform validation +

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +

    +The name of what is being validated. This is included in the error message +

    +
    + +
  • + +
  • + + types + + + (Array, Class) + + + + — +

    +A single class or array of classes that the value is validated against. +

    +
    + +
  • + +
  • + + other + + + (Block) + + + (defaults to: lambda{|v| true }) + + + — +

    +Any block that must evaluate to true for the value to be valid +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +true if validation succeeds. +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArugumentError) + + + + — +

    +Raised if the class of the value provided is not in the specified array of +types or the block passed returns false +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+
+
# File 'lib/axlsx/util/validators.rb', line 34
+
+def self.validate(name, types, v, other= lambda{|v| true })
+  types = [types] unless types.is_a? Array
+  valid_type = false
+  if v.class == Class
+    types.each { |t| valid_type = true if v.ancestors.include?(t) }
+  else
+    types.each { |t| valid_type = true if v.is_a?(t) }
+  end
+  raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless (other.call(v) && valid_type)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Default.html b/doc/Axlsx/Default.html new file mode 100644 index 00000000..9294ab8f --- /dev/null +++ b/doc/Axlsx/Default.html @@ -0,0 +1,575 @@ + + + + + + Class: Axlsx::Default + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Default + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/content_type/default.rb
+ +
+
+ +

Overview

+
+

+An default content part. These parts are automatically created by for you +based on the content of your package. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Default) initialize(options = {}) + + + +

+
+

+Creates a new Default object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + Extension + (String) + + + + +
  • + +
  • + ContentType + (String) + + + + +
  • + +
+ + +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +An argument error is raised if both Extension and ContentType are not +specified. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+19
+20
+21
+
+
# File 'lib/axlsx/content_type/default.rb', line 16
+
+def initialize(options={})
+  raise ArgumentError, "Extension and ContentType are required" unless options[:Extension] && options[:ContentType]
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end      
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) ContentType + + + +

+
+

+ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, +STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, +DRAWING_CT are allowed +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, +STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, +DRAWING_CT are allowed +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/axlsx/content_type/default.rb', line 10
+
+def ContentType
+  @ContentType
+end
+
+
+
+ + + + +
+

+ + - (String) Extension + + + +

+
+

+The extension of the content type. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+7
+8
+9
+
+
# File 'lib/axlsx/content_type/default.rb', line 7
+
+def Extension
+  @Extension
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the object to xml +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/axlsx/content_type/default.rb', line 28
+
+def to_xml(xml)
+  xml.Default(self.instance_values)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Drawing.html b/doc/Axlsx/Drawing.html new file mode 100644 index 00000000..bcaa7592 --- /dev/null +++ b/doc/Axlsx/Drawing.html @@ -0,0 +1,1154 @@ + + + + + + Class: Axlsx::Drawing + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Drawing + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/drawing.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage drawings is to use the Worksheet.add_chart +method, specifying the chart class, start and end marker locations. +

+
+
+ +

+A Drawing is a canvas for charts. Each worksheet has a single drawing that +can specify multiple anchors which reference charts. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Drawing) initialize(worksheet) + + + +

+
+

+Creates a new Drawing object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + worksheet + + + (Worksheet) + + + + — +

    +The worksheet that owns this drawing +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+63
+64
+65
+66
+67
+68
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 63
+
+def initialize(worksheet)
+  DataTypeValidator.validate "Drawing.worksheet", Worksheet, worksheet
+  @worksheet = worksheet
+  @worksheet.workbook.drawings << self
+  @anchors = SimpleTypedList.new TwoCellAnchor
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (SimpleTypedList) anchors (readonly) + + + +

+
+

+A collection of anchors for this drawing +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 35
+
+def anchors
+  @anchors
+end
+
+
+
+ + + + +
+

+ + - (Array) charts (readonly) + + + +

+
+

+An array of charts that are associated with this drawing’s anchors +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 39
+
+def charts
+  @anchors.map { |a| a.graphic_frame.chart }
+end
+
+
+
+ + + + +
+

+ + - (Integer) index (readonly) + + + +

+
+

+The index of this drawing in the owning workbooks’s drawings +collection. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 43
+
+def index
+  @worksheet.workbook.drawings.index(self)
+end
+
+
+
+ + + + +
+

+ + - (String) pn (readonly) + + + +

+
+

+The part name for this drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 51
+
+def pn
+  "#{DRAWING_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (Relationships) relationships (readonly) + + + +

+
+

+The drawing’s relationships. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 59
+
+def relationships
+  r = Relationships.new
+  @anchors.each do |anchor|
+    chart = anchor.graphic_frame.chart
+    r << Relationship.new(CHART_R, "../#{chart.pn}")
+  end
+  r
+end
+
+
+
+ + + + +
+

+ + - (String) rels_pn (readonly) + + + +

+
+

+The relational part name for this drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 55
+
+def rels_pn
+  "#{DRAWING_RELS_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (String) rId (readonly) + + + +

+
+

+The relation reference id for this drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 47
+
+def rId
+  "rId#{index+1}"
+end
+
+
+
+ + + + +
+

+ + - (Worksheet) worksheet (readonly) + + + +

+
+

+The worksheet that owns the drawing +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 30
+
+def worksheet
+  @worksheet
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) add_chart(chart_type, options = {}) + + + +

+
+ +
+ Note: +

+The recommended way to manage charts is to use Worksheet.add_chart. +

+
+
+ +

+Adds a chart to the drawing. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + chart_type + + + (Chart) + + + + — +

    +The class of the chart to be added to the drawing +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + +
  • + +
+ + +
+ + + + +
+
+
+
+75
+76
+77
+78
+79
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 75
+
+def add_chart(chart_type, options={})
+  DataTypeValidator.validate "Drawing.chart_type", Chart, chart_type 
+  TwoCellAnchor.new(self, chart_type, options)
+  @anchors.last.graphic_frame.chart
+end
+
+
+
+ +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+112
+113
+114
+115
+116
+117
+118
+119
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 112
+
+def to_xml
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.send('xdr:wsDr', :'xmlns:xdr'=>XML_NS_XDR, :'xmlns:a'=>XML_NS_A) {
+      anchors.each {|anchor| anchor.to_xml(xml) }
+    }        
+  end
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Fill.html b/doc/Axlsx/Fill.html new file mode 100644 index 00000000..a88f3d0a --- /dev/null +++ b/doc/Axlsx/Fill.html @@ -0,0 +1,460 @@ + + + + + + Class: Axlsx::Fill + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Fill + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/fill.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage styles in your workbook is to use +Styles#add_style. +

+
+
+ +

+The Fill is a formatting object that manages the background color, and +pattern for cells. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Fill) initialize(fill_type) + + + +

+
+

+Creates a new Fill object +

+ + +
+
+
+

Parameters:

+ + +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if the fill_type parameter is not a PatternFill or a GradientFill instance +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/axlsx/stylesheet/fill.rb', line 16
+
+def initialize(fill_type)
+  self.fill_type = fill_type
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (PatternFill, GradientFill) fill_type + + + +

+
+

+The type of fill +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/stylesheet/fill.rb', line 11
+
+def fill_type
+  @fill_type
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the fill +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/axlsx/stylesheet/fill.rb', line 23
+
+def to_xml(xml)
+  xml.fill { @fill_type.to_xml(xml) }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Font.html b/doc/Axlsx/Font.html new file mode 100644 index 00000000..4f03d9dd --- /dev/null +++ b/doc/Axlsx/Font.html @@ -0,0 +1,1554 @@ + + + + + + Class: Axlsx::Font + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Font + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/font.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage fonts, and other styles is Styles#add_style +

+
+
+ +

+The Font class details a font instance for use in styling cells. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Font) initialize(options = {}) + + + +

+
+

+Creates a new Font +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + name + (String) + + + + +
  • + +
  • + charset + (Integer) + + + + +
  • + +
  • + family + (Integer) + + + + +
  • + +
  • + family + (Integer) + + + + +
  • + +
  • + b + (Boolean) + + + + +
  • + +
  • + i + (Boolean) + + + + +
  • + +
  • + strike + (Boolean) + + + + +
  • + +
  • + outline + (Boolean) + + + + +
  • + +
  • + shadow + (Boolean) + + + + +
  • + +
  • + condense + (Boolean) + + + + +
  • + +
  • + extend + (Boolean) + + + + +
  • + +
  • + color + (Color) + + + + +
  • + +
  • + sz + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+98
+99
+100
+101
+102
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 98
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Boolean) b + + + +

+
+

+Indicates if the font should be rendered in bold +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 50
+
+def b
+  @b
+end
+
+
+
+ + + + +
+

+ + - (Integer) charset + + + +

+
+ +
+ Note: +

+The following values are defined in the OOXML specification and are OS +dependant values +

+
+ 0   ANSI_CHARSET
+ 1   DEFAULT_CHARSET
+ 2   SYMBOL_CHARSET
+ 77  MAC_CHARSET
+ 128 SHIFTJIS_CHARSET
+ 129 HANGUL_CHARSET
+ 130 JOHAB_CHARSET
+ 134 GB2312_CHARSET
+ 136 CHINESEBIG5_CHARSET
+ 161 GREEK_CHARSET
+ 162 TURKISH_CHARSET
+ 163 VIETNAMESE_CHARSET
+ 177 HEBREW_CHARSET
+ 178 ARABIC_CHARSET
+ 186 BALTIC_CHARSET
+ 204 RUSSIAN_CHARSET
+ 222 THAI_CHARSET
+ 238 EASTEUROPE_CHARSET
+ 255 OEM_CHARSET
+
+
+
+ +

+The charset of the font +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 33
+
+def charset
+  @charset
+end
+
+
+
+ + + + +
+

+ + - (Color) color + + + +

+
+

+The color of the font +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Color) + + + +
  • + +
+ +
+ + + + +
+
+
+
+78
+79
+80
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 78
+
+def color
+  @color
+end
+
+
+
+ + + + +
+

+ + - (Boolean) condense + + + +

+
+

+Indicates if the font should be condensed +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+70
+71
+72
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 70
+
+def condense
+  @condense
+end
+
+
+
+ + + + +
+

+ + - (Boolean) extend + + + +

+
+

+The font’s extend property +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 74
+
+def extend
+  @extend
+end
+
+
+
+ + + + +
+

+ + - (Integer) family + + + +

+
+ +
+ Note: +

+The following are defined OOXML specification +

+
+ 0 Not applicable.
+ 1 Roman
+ 2 Swiss
+ 3 Modern
+ 4 Script
+ 5 Decorative
+ 6..14 Reserved for future use
+
+
+
+ +

+The font’s family +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 46
+
+def family
+  @family
+end
+
+
+
+ + + + +
+

+ + - (Boolean) i + + + +

+
+

+Indicates if the font should be rendered italicized +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+54
+55
+56
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 54
+
+def i
+  @i
+end
+
+
+
+ + + + +
+

+ + - (String) name + + + +

+
+

+The name of the font +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 8
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Boolean) outline + + + +

+
+

+Indicates if the font should be rendered with an outline +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 62
+
+def outline
+  @outline
+end
+
+
+
+ + + + +
+

+ + - (Boolean) shadow + + + +

+
+

+Indicates if the font should be rendered with a shadow +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+66
+67
+68
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 66
+
+def shadow
+  @shadow
+end
+
+
+
+ + + + +
+

+ + - (Boolean) strike + + + +

+
+

+Indicates if the font should be rendered with a strikthrough +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+58
+59
+60
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 58
+
+def strike
+  @strike
+end
+
+
+
+ + + + +
+

+ + - (Integer) sz + + + +

+
+

+The size of the font. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+82
+83
+84
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 82
+
+def sz
+  @sz
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the fill +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+120
+121
+122
+123
+124
+125
+126
+
+
# File 'lib/axlsx/stylesheet/font.rb', line 120
+
+def to_xml(xml)
+  xml.font {
+    self.instance_values.each do |k, v|
+      v.is_a?(Color) ? v.to_xml(xml) : xml.send(k, {:val => v})            
+    end
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/GradientFill.html b/doc/Axlsx/GradientFill.html new file mode 100644 index 00000000..956af528 --- /dev/null +++ b/doc/Axlsx/GradientFill.html @@ -0,0 +1,1026 @@ + + + + + + Class: Axlsx::GradientFill + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::GradientFill + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/gradient_fill.rb
+ +
+
+ +

Overview

+
+

+A GradientFill defines the color and positioning for gradiant cell fill. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Office XML Part 1 §18.8.24
  • + +
+ +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (GradientFill) initialize(options = {}) + + + +

+
+

+Creates a new GradientFill object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + type + (Symbol) + + + + +
  • + +
  • + degree + (Float) + + + + +
  • + +
  • + left + (Float) + + + + +
  • + +
  • + right + (Float) + + + + +
  • + +
  • + top + (Float) + + + + +
  • + +
  • + bottom + (Float) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+52
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 46
+
+def initialize(options={})
+  options[:type] ||= :linear
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+  @stop = SimpleTypedList.new GradientStop
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Float) bottom + + + +

+
+

+Percentage format bottom +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 33
+
+def bottom
+  @bottom
+end
+
+
+
+ + + + +
+

+ + - (Float) degree + + + +

+
+

+Angle of the linear gradient +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 17
+
+def degree
+  @degree
+end
+
+
+
+ + + + +
+

+ + - (Float) left + + + +

+
+

+Percentage format left +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 21
+
+def left
+  @left
+end
+
+
+
+ + + + +
+

+ + - (Float) right + + + +

+
+

+Percentage format right +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 25
+
+def right
+  @right
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) stop (readonly) + + + +

+
+

+Collection of stop objects +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+37
+38
+39
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 37
+
+def stop
+  @stop
+end
+
+
+
+ + + + +
+

+ + - (Float) top + + + +

+
+

+Percentage format top +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 29
+
+def top
+  @top
+end
+
+
+
+ + + + +
+

+ + - (Symbol) type + + + +

+
+ +
+ Note: +

+valid options are +

+
+ :linear
+ :path
+
+
+
+ +

+The type of gradient. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 13
+
+def type
+  @type
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the gradientFill +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+64
+65
+66
+67
+68
+
+
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 64
+
+def to_xml(xml)
+  xml.gradientFill(self.instance_values.reject { |k,v| k.to_sym == :stop }) {
+    @stop.each { |s| s.to_xml(xml) }
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/GradientStop.html b/doc/Axlsx/GradientStop.html new file mode 100644 index 00000000..eacf1c92 --- /dev/null +++ b/doc/Axlsx/GradientStop.html @@ -0,0 +1,526 @@ + + + + + + Class: Axlsx::GradientStop + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::GradientStop + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/gradient_stop.rb
+ +
+
+ +

Overview

+
+

+The GradientStop object represents a color point in a gradient. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Office XML Part 1 §18.8.24
  • + +
+ +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (GradientStop) initialize(color, position) + + + +

+
+

+Creates a new GradientStop object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + color + + + (Color) + + + +
  • + +
  • + + position + + + (Float) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+18
+19
+20
+21
+
+
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 18
+
+def initialize(color, position)
+  self.color = color
+  self.position = position
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Color) color + + + +

+
+

+The color for this gradient stop +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Color) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 9
+
+def color
+  @color
+end
+
+
+
+ + + + +
+

+ + - (Float) position + + + +

+
+

+The position of the color +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 13
+
+def position
+  @position
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the gradientStop +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+
+
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 29
+
+def to_xml(xml) xml.stop(:position => self.position) {self.color.to_xml(xml)} end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/GraphicFrame.html b/doc/Axlsx/GraphicFrame.html new file mode 100644 index 00000000..490bc3df --- /dev/null +++ b/doc/Axlsx/GraphicFrame.html @@ -0,0 +1,646 @@ + + + + + + Class: Axlsx::GraphicFrame + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::GraphicFrame + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/graphic_frame.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage charts is Worksheet#add_chart +

+
+
+ +

+A graphic frame defines a container for a chart object +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (GraphicFrame) initialize(anchor, chart_type, options) + + + +

+
+

+Creates a new GraphicFrame object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + anchor + + + (TwoCellAnchor) + + + +
  • + +
  • + + chart_type + + + (Class) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+24
+25
+26
+27
+
+
# File 'lib/axlsx/drawing/graphic_frame.rb', line 24
+
+def initialize(anchor, chart_type, options)
+  @anchor = anchor
+  @chart = chart_type.new(self, options)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (TwoCellAnchor) anchor (readonly) + + + +

+
+

+A anchor that holds this frame +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/axlsx/drawing/graphic_frame.rb', line 15
+
+def anchor
+  @anchor
+end
+
+
+
+ + + + +
+

+ + - (Chart) chart (readonly) + + + +

+
+

+A reference to the chart object associated with this frame +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Chart) + + + +
  • + +
+ +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/drawing/graphic_frame.rb', line 11
+
+def chart
+  @chart
+end
+
+
+
+ + + + +
+

+ + - (String) rId (readonly) + + + +

+
+

+The relationship id for this graphic +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/axlsx/drawing/graphic_frame.rb', line 19
+
+def rId 
+  "rId#{@anchor.index+1}"
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the graphic frame +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/axlsx/drawing/graphic_frame.rb', line 36
+
+def to_xml(xml)
+  xml.send('xdr:graphicFrame') {        
+    xml.send('xdr:nvGraphicFramePr') {
+      xml.send('xdr:cNvPr', :id=>2, :name=>chart.title)
+      xml.send('xdr:cNvGraphicFramePr')                
+    }
+    xml.send('xdr:xfrm') {
+      xml.send('a:off', :x=>0, :y=>0)
+      xml.send('a:ext', :cx=>0, :cy=>0)
+    }
+    xml.send('a:graphic') {
+      xml.send('a:graphicData', :uri=>XML_NS_C) {
+        xml.send('c:chart', :'xmlns:c'=>XML_NS_C, :'xmlns:r'=>XML_NS_R, :'r:id'=>rId)
+      }
+    }
+  }
+  
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Marker.html b/doc/Axlsx/Marker.html new file mode 100644 index 00000000..4f22aea1 --- /dev/null +++ b/doc/Axlsx/Marker.html @@ -0,0 +1,857 @@ + + + + + + Class: Axlsx::Marker + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Marker + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/marker.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage markers is Worksheet#add_chart Markers are +created for a two cell anchor based on the :start and :end options. +

+
+
+ +

+The Marker class defines a point in the worksheet that drawing anchors +attach to. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Marker) initialize(options = {}) + + + +

+
+

+Creates a new Marker object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + col + (Integer) + + + + +
  • + +
  • + colOff + (Integer) + + + + +
  • + +
  • + row + (Integer) + + + + +
  • + +
  • + rowOff + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/axlsx/drawing/marker.rb', line 28
+
+def initialize(options={})
+  @col, @colOff, @row, @rowOff = 0, 0, 0, 0
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end      
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Integer) col + + + +

+
+

+The column this marker anchors to +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/drawing/marker.rb', line 9
+
+def col
+  @col
+end
+
+
+
+ + + + +
+

+ + - (Integer) colOff + + + +

+
+

+The offset distance from this marker’s column +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/drawing/marker.rb', line 13
+
+def colOff
+  @colOff
+end
+
+
+
+ + + + +
+

+ + - (Integer) row + + + +

+
+

+The row this marker anchors to +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/axlsx/drawing/marker.rb', line 17
+
+def row
+  @row
+end
+
+
+
+ + + + +
+

+ + - (Integer) rowOff + + + +

+
+

+The offset distance from this marker’s row +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/axlsx/drawing/marker.rb', line 21
+
+def rowOff
+  @rowOff
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) coord(col, row) + + + +

+
+

+shortcut to set the column, row position for this marker +

+ + +
+
+
+

Parameters:

+
    + +
  • + + col + + + + + + + — +

    +the column for the marker +

    +
    + +
  • + +
  • + + row + + + + + + + — +

    +the row of the marker +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+43
+44
+45
+46
+
+
# File 'lib/axlsx/drawing/marker.rb', line 43
+
+def coord(col, row)
+  self.col = col
+  self.row = row
+end
+
+
+
+ +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the marker +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+
+
# File 'lib/axlsx/drawing/marker.rb', line 50
+
+def to_xml(xml)
+  [:col, :colOff, :row, :rowOff].each do |k|
+    xml.send("xdr:#{k.to_s}", self.send(k))
+  end      
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/NumFmt.html b/doc/Axlsx/NumFmt.html new file mode 100644 index 00000000..37a7fa6b --- /dev/null +++ b/doc/Axlsx/NumFmt.html @@ -0,0 +1,562 @@ + + + + + + Class: Axlsx::NumFmt + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::NumFmt + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/num_fmt.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage styles is Styles#add_style +

+
+
+ +

+A NumFmt object defines an identifier and formatting code for data in +cells. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (NumFmt) initialize(options = {}) + + + +

+
+

+A new instance of NumFmt +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/axlsx/stylesheet/num_fmt.rb', line 45
+
+def initialize(options={})
+  @numFmtId = 0
+  @formatCode = ""
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) formatCode + + + +

+
+

+The formatting to use for this number format. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +The formatting to use for this number format. +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/axlsx/stylesheet/num_fmt.rb', line 44
+
+def formatCode
+  @formatCode
+end
+
+
+
+ + + + +
+

+ + - (Integer) numFmtId + + + +

+
+ +
+ Note: +

+These are the known formats I can dig up. The constant NUM_FMT_PERCENT is +9, and uses the default % formatting. Axlsx also defines a few formats for +date and time that are commonly used in asia as NUM_FMT_YYYYMMDD and +NUM_FRM_YYYYMMDDHHMMSS. +

+
+ 1 0
+ 2 0.00
+ 3 #,##0
+ 4 #,##0.00
+ 5 $#,##0_);($#,##0)
+ 6 $#,##0_);[Red]($#,##0)
+ 7 $#,##0.00_);($#,##0.00)
+ 8 $#,##0.00_);[Red]($#,##0.00)
+ 9 0%
+ 10 0.00%
+ 11 0.00E+00
+ 12 # ?/?
+ 13 # ??/??
+ 14 m/d/yyyy
+ 15 d-mmm-yy
+ 16 d-mmm
+ 17 mmm-yy
+ 18 h:mm AM/PM
+ 19 h:mm:ss AM/PM
+ 20 h:mm
+ 21 h:mm:ss
+ 22 m/d/yyyy h:mm
+ 37 #,##0_);(#,##0)
+ 38 #,##0_);[Red](#,##0)
+ 39 #,##0.00_);(#,##0.00)
+ 40 #,##0.00_);[Red](#,##0.00)
+ 45 mm:ss
+ 46 [h]:mm:ss
+ 47 mm:ss.0
+ 48 ##0.0E+0
+ 49 @
+
+
+
+ +

+An unsinged integer referencing a standard or custom number format. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +An unsinged integer referencing a standard or custom number format. +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+40
+41
+42
+
+
# File 'lib/axlsx/stylesheet/num_fmt.rb', line 40
+
+def numFmtId
+  @numFmtId
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) to_xml(xml) + + + +

+
+

+Creates a numFmt element applying the instance values of this object as +attributes. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+58
+
+
# File 'lib/axlsx/stylesheet/num_fmt.rb', line 58
+
+def to_xml(xml) xml.numFmt(self.instance_values) end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Override.html b/doc/Axlsx/Override.html new file mode 100644 index 00000000..992fd711 --- /dev/null +++ b/doc/Axlsx/Override.html @@ -0,0 +1,568 @@ + + + + + + Class: Axlsx::Override + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Override + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/content_type/override.rb
+ +
+
+ +

Overview

+
+

+An override content part. These parts are automatically created by for you +based on the content of your package. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Override) initialize(options = {}) + + + +

+
+

+Creates a new Override object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + PartName + (String) + + + + +
  • + +
  • + ContentType + (String) + + + + +
  • + +
+ + +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +An argument error is raised if both PartName and ContentType are not +specified. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+15
+16
+17
+18
+19
+20
+
+
# File 'lib/axlsx/content_type/override.rb', line 15
+
+def initialize(options={})
+  raise ArgumentError, "PartName and ContentType are required" unless options[:PartName] && options[:ContentType]
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end      
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) ContentType + + + +

+
+

+ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, +STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, +DRAWING_CT are allowed +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, +STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, +DRAWING_CT are allowed +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/axlsx/content_type/override.rb', line 6
+
+def ContentType
+  @ContentType
+end
+
+
+
+ + + + +
+

+ + - (String) PartName + + + +

+
+

+PartName The name and location of the part. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    +PartName The name and location of the part. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/content_type/override.rb', line 9
+
+def PartName
+  @PartName
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) to_xml(xml) + + + +

+
+

+Serializes the Override object to xml +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/axlsx/content_type/override.rb', line 26
+
+def to_xml(xml)
+  xml.Override(self.instance_values)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Package.html b/doc/Axlsx/Package.html new file mode 100644 index 00000000..b7eecce2 --- /dev/null +++ b/doc/Axlsx/Package.html @@ -0,0 +1,1293 @@ + + + + + + Class: Axlsx::Package + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Package + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/package.rb
+ +
+
+ +

Overview

+
+

+Package is responsible for managing all the bits and peices that Open +Office XML requires to make a valid xlsx document including valdation and +serialization. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Package) initialize(options = {}) {|_self| ... } + + + +

+
+

+Initializes your package +

+ + +
+
+
+ +
+

Examples:

+ +

+Package.new :author => ‘you!’, :workbook => Workbook.new +

+

+
+
+ +
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +A hash that you can use to specify the author and workbook for this +package. +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + :author + (String) + + + + —

    +The author of the document +

    +
    +
  • + +
+ + +

Yields:

+
    + +
  • + + + (_self) + + + +
  • + +
+

Yield Parameters:

+
    + +
  • + + _self + + + (Axlsx::Package) + + + + — +

    +the object that the method was called on +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+
+
# File 'lib/axlsx/package.rb', line 28
+
+def initialize(options={})
+  @core, @app = Core.new, App.new
+  @core.creator = options[:author] || @core.creator
+  yield self if block_given?
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Workbook) workbook + + + +

+
+ +
+ Note: +

+As there are multiple ways to instantiate a workbook for the package, here +are a few examples: +

+
+  # assign directly during package instanciation
+  wb = Package.new(:workbook => Workbook.new).workbook
+
+  # get a fresh workbook automatically from the package
+  wb = Pacakge.new().workbook
+  #     # set the workbook after creating the package
+  wb = Package.new().workbook = Workbook.new
+
+
+
+ +

+The workbook this package will serialize or validate. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Workbook) + + + + — +

    +If no workbook instance has been assigned with this package a new Workbook +instance is returned. +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + + + + + +

    +ArgumentError if workbook parameter is not a Workbook instance. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/axlsx/package.rb', line 21
+
+def workbook
+  @workbook || @workbook = Workbook.new
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (ContentType) base_content_types + + + +

+
+

+Creates the minimum content types for generating a valid xlsx document. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+
+
# File 'lib/axlsx/package.rb', line 156
+
+def base_content_types
+  c_types = ContentType.new()
+  c_types <<  Default.new(:ContentType => RELS_CT, :Extension => RELS_EX)
+  c_types <<  Default.new(:Extension => XML_EX, :ContentType => XML_CT)
+  c_types << Override.new(:PartName => "/#{APP_PN}", :ContentType => APP_CT)
+  c_types << Override.new(:PartName => "/#{CORE_PN}", :ContentType => CORE_CT)
+  c_types << Override.new(:PartName => "/xl/#{STYLES_PN}", :ContentType => STYLES_CT)
+  c_types << Axlsx::Override.new(:PartName => "/#{WORKBOOK_PN}", :ContentType => WORKBOOK_CT)      
+  c_types.lock
+  c_types
+end
+
+
+
+ +
+

+ + - (ContentType) content_types + + + +

+
+

+Appends override objects for drawings, charts, and sheets as they exist in +your workbook to the default content types. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+
+
# File 'lib/axlsx/package.rb', line 136
+
+def content_types
+  c_types = base_content_types
+  workbook.drawings.each do |drawing|
+    c_types << Axlsx::Override.new(:PartName => "/xl/#{drawing.pn}", 
+                                   :ContentType => DRAWING_CT)
+  end
+  workbook.charts.each do |chart|
+    c_types << Axlsx::Override.new(:PartName => "/xl/#{chart.pn}", 
+                                   :ContentType => CHART_CT)                    
+  end
+  workbook.worksheets.each do |sheet|
+    c_types << Axlsx::Override.new(:PartName => "/xl/#{sheet.pn}", 
+                                     :ContentType => WORKSHEET_CT)
+  end
+  c_types
+end
+
+
+
+ +
+

+ + - (Array) parts + + + +

+
+

+The parts of a package +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    +An array of hashes that define the entry, document and schema for each part +of the package. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+
+
# File 'lib/axlsx/package.rb', line 90
+
+def parts
+  @parts = [
+   {:entry => RELS_PN, :doc => relationships.to_xml, :schema => RELS_XSD},
+   {:entry => CORE_PN, :doc => @core.to_xml, :schema => CORE_XSD},
+   {:entry => APP_PN, :doc => @app.to_xml, :schema => APP_XSD},
+   {:entry => WORKBOOK_RELS_PN, :doc => workbook.relationships.to_xml, :schema => RELS_XSD},
+   {:entry => WORKBOOK_PN, :doc => workbook.to_xml, :schema => SML_XSD},
+   {:entry => CONTENT_TYPES_PN, :doc => content_types.to_xml, :schema => CONTENT_TYPES_XSD},
+   {:entry => "xl/#{STYLES_PN}", :doc => workbook.styles.to_xml, :schema => SML_XSD}
+  ]
+  workbook.drawings.each do |drawing|
+    @parts << {:entry => "xl/#{drawing.rels_pn}", :doc => drawing.relationships.to_xml, :schema => RELS_XSD}
+    @parts << {:entry => "xl/#{drawing.pn}", :doc => drawing.to_xml, :schema => DRAWING_XSD}
+  end
+    
+  workbook.charts.each do |chart|          
+    @parts << {:entry => "xl/#{chart.pn}", :doc => chart.to_xml, :schema => DRAWING_XSD}
+  end                  
+ 
+  workbook.worksheets.each do |sheet|            
+    @parts << {:entry => "xl/#{sheet.rels_pn}", :doc => sheet.relationships.to_xml, :schema => RELS_XSD}
+    @parts << {:entry => "xl/#{sheet.pn}", :doc => sheet.to_xml, :schema => SML_XSD}        
+  end
+  @parts
+end
+
+
+
+ +
+

+ + - (Relationships) relationships + + + +

+
+

+Creates the relationships required for a valid xlsx document +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+171
+172
+173
+174
+175
+176
+177
+178
+
+
# File 'lib/axlsx/package.rb', line 171
+
+def relationships
+  rels = Axlsx::Relationships.new
+  rels << Relationship.new(WORKBOOK_R, WORKBOOK_PN)
+  rels << Relationship.new(CORE_R, CORE_PN)
+  rels << Relationship.new(APP_R, APP_PN)
+  rels.lock
+  rels
+end
+
+
+
+ +
+

+ + - (Boolean) serialize(output, confirm_valid = false) + + + +

+
+ +
+ Note: +

+A tremendous amount of effort has gone into ensuring that you cannot create +invalid xlsx documents. confirm_valid should be used in the rare case that +you cannot open the serialized file. +

+
+
+ +

+Serialize your workbook to disk as an xlsx document. +

+ + +
+
+
+ +
+

Examples:

+ +

+
# This is how easy it is to create a valid xlsx file. Of course you might want to add a sheet or two, and maybe some data, styles and charts.
+# Take a look at the README for an example of how to do it!
+f = File.open('test.xlsx', 'w')
+Package.new.serialize(f)
+
+# You will find a file called test.xlsx
+
+ +
+

Parameters:

+
    + +
  • + + output + + + (File) + + + + — +

    +The file you want to serialize your package to +

    +
    + +
  • + +
  • + + confirm_valid + + + (Boolean) + + + (defaults to: false) + + + — +

    +Validate the package prior to serialization. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +False if confirm_valid and validation errors exist. True if the package was +serialized +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/axlsx/package.rb', line 55
+
+def serialize(output, confirm_valid=false)
+  return false unless !confirm_valid || self.validate.empty?
+  f = File.new(output, "w")
+  Zip::ZipOutputStream.open(f.path) do |zip|
+    parts.each{ |part| zip.put_next_entry(part[:entry]); zip.puts(part[:doc]) }
+  end
+  true
+end
+
+
+
+ +
+

+ + - (Array) validate + + + +

+
+ +
+ Note: +

+This gem includes all schema from OfficeOpenXML-XMLSchema-Transitional.zip +and OpenPackagingConventions-XMLSchema.zip as per ECMA-376, Third edition. +opc schema require an internet connection to import remote schema from +dublin core for dc, dcterms and xml namespaces. Those remote schema are +included in this gem, and the original files have been altered to refer to +the local versions. +

+

+If by chance you are able to creat a package that does not validate it +indicates that the internal validation is not robust enough and needs to be +improved. Please report your errors to the gem author. +

+
+
+ +

+Validate all parts of the package against xsd schema. +

+ + +
+
+
+ +
+

Examples:

+ +

+
# The following will output any error messages found in serialization.
+p = Axlsx::Package.new
+# ... code to create sheets, charts, styles etc.
+p.validate.each { |error| puts error.message }
+
+ +
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    +An array of all validation errors found. +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+79
+80
+81
+82
+83
+
+
# File 'lib/axlsx/package.rb', line 79
+
+def validate
+  errors = []
+  parts.each { |part| errors.concat validate_single_doc(part[:schema], part[:doc]) }
+  errors
+end
+
+
+
+ +
+

+ + - (Array) validate_single_doc(schema, doc) + + + +

+
+

+Performs xsd validation for a signle document +

+ + +
+
+
+

Parameters:

+
    + +
  • + + schema + + + (String) + + + + — +

    +path to the xsd schema to be used in validation. +

    +
    + +
  • + +
  • + + doc + + + (String) + + + + — +

    +The xml text to be validated +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    +An array of all validation errors encountered. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+
+
# File 'lib/axlsx/package.rb', line 122
+
+def validate_single_doc(schema, doc)
+  schema = Nokogiri::XML::Schema(File.open(schema))
+  doc = Nokogiri::XML(doc)
+
+  errors = []
+  schema.validate(doc).each do |error|
+    errors << error
+  end
+  errors
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/PatternFill.html b/doc/Axlsx/PatternFill.html new file mode 100644 index 00000000..501cd1cb --- /dev/null +++ b/doc/Axlsx/PatternFill.html @@ -0,0 +1,681 @@ + + + + + + Class: Axlsx::PatternFill + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::PatternFill + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/pattern_fill.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage styles is with Styles#add_style +

+
+
+ +

+A PatternFill is the pattern and solid fill styling for a cell. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Style#add_style
  • + +
+ +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (PatternFill) initialize(options = {}) + + + +

+
+

+Creates a new PatternFill Object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + patternType + (Symbol) + + + + +
  • + +
  • + fgColor + (Color) + + + + +
  • + +
  • + bgColor + (Color) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+
+
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 44
+
+def initialize(options={})
+  @patternType = :none
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Color) bgColor + + + +

+
+

+The color to use for the background of the fill when the type is not solid. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Color) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 13
+
+def bgColor
+  @bgColor
+end
+
+
+
+ + + + +
+

+ + - (Color) fgColor + + + +

+
+

+The color to use for the the background in solid fills. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Color) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 9
+
+def fgColor
+  @fgColor
+end
+
+
+
+ + + + +
+

+ + - (Object) patternType + + + +

+
+ +
+ Note: +

+patternType must be one of +

+
+ :none
+ :solid
+ :mediumGray
+ :darkGray
+ :lightGray
+ :darkHorizontal
+ :darkVertical
+ :darkDown
+ :darkUp
+ :darkGrid
+ :darkTrellis
+ :lightHorizontal
+ :lightVertical
+ :lightDown
+ :lightUp
+ :lightGrid
+ :lightTrellis
+ :gray125
+ :gray0625
+
+
+
+ +

+The pattern type to use +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Open XML Part 1 18.18.55
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 38
+
+def patternType
+  @patternType
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the pattern fill +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+58
+59
+60
+61
+62
+
+
# File 'lib/axlsx/stylesheet/pattern_fill.rb', line 58
+
+def to_xml(xml) 
+  xml.patternFill(:patternType => self.patternType) { 
+    self.instance_values.reject { |k,v| k.to_sym == :patternType }.each { |k,v| xml.send(k, v.instance_values) }    
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Pie3DChart.html b/doc/Axlsx/Pie3DChart.html new file mode 100644 index 00000000..e3b3e318 --- /dev/null +++ b/doc/Axlsx/Pie3DChart.html @@ -0,0 +1,439 @@ + + + + + + Class: Axlsx::Pie3DChart + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Pie3DChart + + + +

+ +
+ +
Inherits:
+
+ Chart + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/pie_3D_chart.rb
+ +
+
+ +

Overview

+
+

+The Pie3DChart is a three dimentional piechart (who would have guessed?) +that you can add to your worksheet. +

+ + +
+
+
+ +
+

Examples:

+ +

+Creating a chart +

+

+
# This example creates two charts in a single sheet.
+# The first uses data directly fed to the sheet, while the second references cells withing the worksheet for data.
+
+require "rubygems" # if that is your preferred way to manage gems!
+require "axlsx"
+
+p = Axlsx::Package.new
+ws = p.workbook.add_worksheet
+ws.add_row :values => ["This is a chart with no data in the sheet"]
+
+chart = ws.add_chart(Axlsx::Pie3DChart, :start_at=> [0,1], :end_at=>[0,6], :title=>"Most Popular Pets")
+chart.add_series :data => [1, 9, 10], :labels => ["Slimy Reptiles", "Fuzzy Bunnies", "Rottweiler"]
+
+ws.add_row :values => ["This chart uses the data below"]
+title_row = ws.add_row :values => ["Least Popular Pets"]
+label_row = ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"]
+data_row = ws.add_row :values => ["Votes", 6, 4, 1]
+
+chart = ws.add_chart(Axlsx::Pie3DChart, :start_at => [0,11], :end_at =>[0,16], :title => title_row.cells.last)
+chart.add_series :data => data_row.cells[(1..-1)], :labels => label_row.cells  
+
+f = File.open('example_pie_3d_chart.xlsx', 'w')
+p.serialize(f)
+
+ +
+ + +

See Also:

+ + +
+ + + + + + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from Chart

+

end_at, graphic_frame, index, pn, series, series_type, show_legend, start_at, title, view3D

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from Chart

+

#add_series

+
+

Constructor Details

+ +
+

+ + - (Pie3DChart) initialize(workbook, options = {}) + + + +

+
+

+Creates a new pie chart object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + workbook + + + (Workbook) + + + + — +

    +The workbook that owns this chart. +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + title + (Cell, String) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+41
+42
+43
+44
+45
+46
+
+
# File 'lib/axlsx/drawing/pie_3D_chart.rb', line 41
+
+def initialize(workbook, options={})
+  super(workbook, options)
+  # this charts series type
+  @series_type = PieSeries
+  @view3D = View3D.new(:rotX => 30, :perspective => 30)
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the pie chart +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+
+
# File 'lib/axlsx/drawing/pie_3D_chart.rb', line 50
+
+def to_xml
+  super() do |xml|
+    xml.send('c:pie3DChart') {
+      xml.send('c:varyColors', :val=>1)
+      @series.each { |ser| ser.to_xml(xml) }
+    }                      
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/PieSeries.html b/doc/Axlsx/PieSeries.html new file mode 100644 index 00000000..b100d89d --- /dev/null +++ b/doc/Axlsx/PieSeries.html @@ -0,0 +1,762 @@ + + + + + + Class: Axlsx::PieSeries + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::PieSeries + + + +

+ +
+ +
Inherits:
+
+ Series + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/pie_series.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage series is to use Chart#add_series +

+
+
+ +

+A PieSeries defines the title, data and labels for pie charts +

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from Series

+

chart, index, order, title

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + +
+

Constructor Details

+ +
+

+ + - (PieSeries) initialize(chart, options = {}) + + + +

+
+

+Creates a new series +

+ + +
+
+
+

Parameters:

+
    + +
  • + + chart + + + (Chart) + + + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + data + (Array, SimpleTypedList) + + + + +
  • + +
  • + labels + (Array, SimpleTypedList) + + + + +
  • + +
  • + title + (String) + + + + +
  • + +
  • + explosion + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+
+
# File 'lib/axlsx/drawing/pie_series.rb', line 28
+
+def initialize(chart, options={})
+  super(chart, options)
+  self.data = options[:data]  || []
+  self.labels = options[:labels] || []
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Array, SimpleTypedList) data + + + +

+
+

+The data for this series. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/axlsx/drawing/pie_series.rb', line 10
+
+def data
+  @data
+end
+
+
+
+ + + + +
+

+ + - (Array, SimpleTypedList) explosion + + + +

+
+

+The explosion for this series +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/axlsx/drawing/pie_series.rb', line 20
+
+def explosion
+  @explosion
+end
+
+
+
+ + + + +
+

+ + - (Array, SimpleTypedList) labels + + + +

+
+

+The labels for this series. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/axlsx/drawing/pie_series.rb', line 15
+
+def labels
+  @labels
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the series +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+
+
# File 'lib/axlsx/drawing/pie_series.rb', line 38
+
+def to_xml(xml)
+  super(xml) do  |xml|
+    xml.send('c:explosion', :val=>@explosion) unless @explosion.nil?
+    if !labels.empty?
+      xml.send('c:cat') {
+        xml.send('c:strRef') {
+          xml.send('c:f', Axlsx::cell_range(labels))
+          xml.send('c:strCache') {
+            xml.send('c:ptCount', :val=>labels.size)
+            labels.each_with_index do |cell, index|
+              v = cell.is_a?(Cell) ? cell.value : cell
+              xml.send('c:pt', :idx=>index) {
+                xml.send('c:v', v)
+              }                          
+            end
+          }
+        }
+      }
+    end
+    xml.send('c:val') {
+      xml.send('c:numRef') {
+        xml.send('c:f', Axlsx::cell_range(data))
+        xml.send('c:numCache') {
+          xml.send('c:formatCode', 'General')
+          xml.send('c:ptCount', :val=>data.size)
+          data.each_with_index do |cell, index|
+            v = cell.is_a?(Cell) ? cell.value : cell
+            xml.send('c:pt', :idx=>index) {
+              xml.send('c:v', v) 
+            }
+          end
+        }                        
+      }
+    }
+    
+  end      
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/RegexValidator.html b/doc/Axlsx/RegexValidator.html new file mode 100644 index 00000000..41ea5e3a --- /dev/null +++ b/doc/Axlsx/RegexValidator.html @@ -0,0 +1,268 @@ + + + + + + Class: Axlsx::RegexValidator + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::RegexValidator + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/util/validators.rb
+ +
+
+ +

Overview

+
+

+Validates the value against the regular expression provided. +

+ + +
+
+
+ + +
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) validate(name, regex, v) + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +

    +The name of what is being validated. This is included in the output when +the value is invalid +

    +
    + +
  • + +
  • + + regex + + + (Regexp) + + + + — +

    +The regular expression to evaluate +

    +
    + +
  • + +
  • + + v + + + (Any) + + + + — +

    +The value to validate. +

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/axlsx/util/validators.rb', line 21
+
+def self.validate(name, regex, v)
+  raise ArgumentError, (ERR_REGEX % [v.inspect, regex.to_s]) unless (v.respond_to?(:=~) && v =~ regex)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Relationship.html b/doc/Axlsx/Relationship.html new file mode 100644 index 00000000..9d94f557 --- /dev/null +++ b/doc/Axlsx/Relationship.html @@ -0,0 +1,554 @@ + + + + + + Class: Axlsx::Relationship + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Relationship + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/rels/relationship.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Packages automatcially manage relationships. +

+
+
+ +

+A relationship defines a reference between package parts. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Relationship) initialize(type, target) + + + +

+
+

+A new instance of Relationship +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+24
+25
+26
+27
+
+
# File 'lib/axlsx/rels/relationship.rb', line 24
+
+def initialize(type, target)
+  self.Target=target
+  self.Type=type
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) Target + + + +

+
+

+The location of the relationship target +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/rels/relationship.rb', line 8
+
+def Target
+  @Target
+end
+
+
+
+ + + + +
+

+ + - (String) Type + + + +

+
+ +
+ Note: +

+Supported types are defined as constants in Axlsx: +

+
+
+ +

+The type of relationship +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/axlsx/rels/relationship.rb', line 23
+
+def Type
+  @Type
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml, rId) + + + +

+
+

+Serializes the relationship TODO: use object.rId to get this infomation +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
  • + + rId + + + (String) + + + + — +

    +the reference id of the object. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+40
+41
+
+
# File 'lib/axlsx/rels/relationship.rb', line 37
+
+def to_xml(xml, rId)
+  h = self.instance_values
+  h[:Id] = rId
+  xml.Relationship(h)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Relationships.html b/doc/Axlsx/Relationships.html new file mode 100644 index 00000000..d5e76faf --- /dev/null +++ b/doc/Axlsx/Relationships.html @@ -0,0 +1,343 @@ + + + + + + Class: Axlsx::Relationships + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Relationships + + + +

+ +
+ +
Inherits:
+
+ SimpleTypedList + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/rels/relationships.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The package automatically manages releationships. +

+
+
+ +

+Relationships are a collection of Relations that define how package parts +are related. +

+ + +
+
+
+ + +
+ + + + + + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from SimpleTypedList

+

allowed_types, locked_at, serialize_as

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from SimpleTypedList

+

#<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

+
+

Constructor Details

+ +
+

+ + - (Relationships) initialize + + + +

+
+

+Creates a new Relationships collection based on SimpleTypedList +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/rels/relationships.rb', line 9
+
+def initialize
+  super Relationship
+end
+
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class Axlsx::SimpleTypedList + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the relationships document. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+15
+16
+17
+18
+19
+20
+21
+22
+
+
# File 'lib/axlsx/rels/relationships.rb', line 15
+
+def to_xml()
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.Relationships(:xmlns => Axlsx::RELS_R) {
+      each_with_index { |rel, index| rel.to_xml(xml, "rId#{index+1}") }
+    }
+  end
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/RestrictionValidator.html b/doc/Axlsx/RestrictionValidator.html new file mode 100644 index 00000000..a9020501 --- /dev/null +++ b/doc/Axlsx/RestrictionValidator.html @@ -0,0 +1,300 @@ + + + + + + Class: Axlsx::RestrictionValidator + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::RestrictionValidator + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/util/validators.rb
+ +
+
+ +

Overview

+
+

+Validate a value against a specific list of allowed values. +

+ + +
+
+
+ + +
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Boolean) validate(name, choices, v) + + + +

+
+

+Perform validation +

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +

    +The name of what is being validatied. This is included in the error message +

    +
    + +
  • + +
  • + + choices + + + (Array) + + + + — +

    +The list of choices to validate against +

    +
    + +
  • + +
  • + + v + + + (Any) + + + + — +

    +The value to be validated +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +true if validation succeeds. +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +Raised if the value provided is not in the list of choices. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+10
+11
+12
+13
+
+
# File 'lib/axlsx/util/validators.rb', line 10
+
+def self.validate(name, choices, v)
+  raise ArgumentError, (ERR_RESTRICTION % [v.to_s, name, choices.inspect]) unless choices.include?(v)      
+  true
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Row.html b/doc/Axlsx/Row.html new file mode 100644 index 00000000..7c2bee3d --- /dev/null +++ b/doc/Axlsx/Row.html @@ -0,0 +1,771 @@ + + + + + + Class: Axlsx::Row + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Row + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/workbook/worksheet/row.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage rows and cells is to use Worksheet#add_row +

+
+
+ +

+A Row is a single row in a worksheet. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Row) initialize(worksheet, values = [], options = {}) + + + +

+
+

+Creates a new row. New Cell objects are created based on the values, types +and style options. A new cell is created for each item in the values array. +style and types options are applied as follows: +

+
+  If the types option is defined and is a symbol it is applied to all the cells created.
+  If the types option is an array, cell types are applied by index for each cell
+  If the types option is not set, the cell will automatically determine its type.
+  If the style option is defined and is an Integer, it is applied to all cells created.
+  If the style option is an array, style is applied by index for each cell.
+  If the style option is not defined, the default style (0) is applied to each cell.
+
+ + +
+
+
+

Parameters:

+
    + +
  • + + worksheet + + + (Worksheet) + + + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (options):

+
    + +
  • + values + (Array) + + + + +
  • + +
  • + types + (Array, Symbol) + + + + +
  • + +
  • + style + (Array, Integer) + + + + +
  • + +
+ + + +

See Also:

+ + +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+
+
# File 'lib/axlsx/workbook/worksheet/row.rb', line 33
+
+def initialize(worksheet, values=[], options={})
+  self.worksheet = worksheet
+  @cells = SimpleTypedList.new Cell
+  @worksheet.rows << self
+  array_to_cells(values, options)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (SimpleTypedList) cells (readonly) + + + +

+
+

+The cells this row holds +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/workbook/worksheet/row.rb', line 13
+
+def cells
+  @cells
+end
+
+
+
+ + + + +
+

+ + - (Integer) index (readonly) + + + +

+
+

+The index of this row in the worksheet +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/axlsx/workbook/worksheet/row.rb', line 17
+
+def index 
+  worksheet.rows.index(self)
+end
+
+
+
+ + + + +
+

+ + - (Worksheet) worksheet + + + +

+
+

+The worksheet this row belongs to +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/workbook/worksheet/row.rb', line 9
+
+def worksheet
+  @worksheet
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Cell) add_cell(value = "", options = {}) + + + +

+
+

+Adds a singel sell to the row based on the data provided and updates the +worksheet’s autofit data. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Cell) + + + +
  • + +
+ +
+ + + + +
+
+
+
+53
+54
+55
+56
+57
+
+
# File 'lib/axlsx/workbook/worksheet/row.rb', line 53
+
+def add_cell(value="", options={})
+  c = Cell.new(self, value, options)
+  update_auto_fit_data
+  c
+end
+
+
+
+ +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the row +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/axlsx/workbook/worksheet/row.rb', line 47
+
+def to_xml(xml)
+  xml.row(:r => index+1) { @cells.each { |cell| cell.to_xml(xml) } }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Scaling.html b/doc/Axlsx/Scaling.html new file mode 100644 index 00000000..1e565899 --- /dev/null +++ b/doc/Axlsx/Scaling.html @@ -0,0 +1,740 @@ + + + + + + Class: Axlsx::Scaling + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Scaling + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/scaling.rb
+ +
+
+ +

Overview

+
+

+The Scaling class defines axis scaling +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Scaling) initialize(options = {}) + + + +

+
+

+creates a new Scaling object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + logBase + (Integer, Fixnum) + + + + +
  • + +
  • + orientation + (Symbol) + + + + +
  • + +
  • + max + (Float) + + + + +
  • + +
  • + min + (Float) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/axlsx/drawing/scaling.rb', line 28
+
+def initialize(options={})
+  @orientation = :minMax
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Integer) logBase + + + +

+
+

+logarithmic base for a logarithmic axis. must be between 2 and 1000 +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/drawing/scaling.rb', line 8
+
+def logBase
+  @logBase
+end
+
+
+
+ + + + +
+

+ + - (Float) max + + + +

+
+

+the maximum scaling +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/axlsx/drawing/scaling.rb', line 17
+
+def max
+  @max
+end
+
+
+
+ + + + +
+

+ + - (Float) min + + + +

+
+

+the minimu scaling +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/axlsx/drawing/scaling.rb', line 21
+
+def min
+  @min
+end
+
+
+
+ + + + +
+

+ + - (Symbol) orientation + + + +

+
+

+the orientation of the axis must be one of [:minMax, :maxMin] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/drawing/scaling.rb', line 13
+
+def orientation
+  @orientation
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the axId +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/axlsx/drawing/scaling.rb', line 43
+
+def to_xml(xml)
+  xml.send('c:scaling') {
+    xml.send('c:logBase', :val=> @logBase) unless @logBase.nil?
+    xml.send('c:orientation', :val=> @orientation) unless @orientation.nil?
+    xml.send('c:min', :val => @min) unless @min.nil?
+    xml.send('c:max', :val => @max) unless @max.nil?
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Series.html b/doc/Axlsx/Series.html new file mode 100644 index 00000000..1b698011 --- /dev/null +++ b/doc/Axlsx/Series.html @@ -0,0 +1,750 @@ + + + + + + Class: Axlsx::Series + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Series + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/series.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage series is to use Chart#add_series +

+
+
+ +

+A Series defines the title, data and labels for chart data. +

+ + +
+
+
+ + +

See Also:

+ + +
+

Direct Known Subclasses

+

BarSeries, PieSeries

+
+ + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Series) initialize(chart, options = {}) + + + +

+
+

+Creates a new series +

+ + +
+
+
+

Parameters:

+
    + +
  • + + chart + + + (Chart) + + + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + order + (Integer) + + + + +
  • + +
  • + title + (String) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/axlsx/drawing/series.rb', line 28
+
+def initialize(chart, options={})
+  self.chart = chart
+  @chart.series << self
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Chart) chart + + + +

+
+

+The chart that owns this series +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Chart) + + + +
  • + +
+ +
+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/axlsx/drawing/series.rb', line 10
+
+def chart
+  @chart
+end
+
+
+
+ + + + +
+

+ + - (Object) index (readonly) + + + +

+
+

+retrieves the series index in the chart’s series collection +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/axlsx/drawing/series.rb', line 14
+
+def index
+  @chart.series.index(self)
+end
+
+
+
+ + + + +
+

+ + - (Integer) order + + + +

+
+

+The order of this series in the chart’s series. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/axlsx/drawing/series.rb', line 18
+
+def order
+  @order || index
+end
+
+
+
+ + + + +
+

+ + - (String) title + + + +

+
+

+The title of the series +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/axlsx/drawing/series.rb', line 22
+
+def title
+  @title
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the series +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/axlsx/drawing/series.rb', line 57
+
+def to_xml(xml)
+  xml.send('c:ser') {
+    xml.send('c:idx', :val=>index)
+    xml.send('c:order', :val=>order || index)
+    xml.send('c:tx') {
+      xml.send('c:v', self.title)
+    }
+    yield xml if block_given?
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/SimpleTypedList.html b/doc/Axlsx/SimpleTypedList.html new file mode 100644 index 00000000..d171532c --- /dev/null +++ b/doc/Axlsx/SimpleTypedList.html @@ -0,0 +1,1617 @@ + + + + + + Class: Axlsx::SimpleTypedList + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::SimpleTypedList + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/util/simple_typed_list.rb
+ +
+
+ +

Overview

+
+

+A SimpleTypedList is a type restrictive collection that allows some of the +methods from Array and supports basic xml serialization. +

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

ContentType, Relationships, TableStyle, TableStyles

+
+ + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (SimpleTypedList) initialize(type, serialize_as = nil) + + + +

+
+

+Creats a new typed list +

+ + +
+
+
+

Parameters:

+
    + +
  • + + type + + + (Array, Class) + + + + — +

    +An array of Class objects or a single Class object +

    +
    + +
  • + +
  • + + serialize + + + (String) + + + + — +

    +The tag name to use in serialization +

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if all members of type are not Class objects +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 22
+
+def initialize type, serialize_as=nil
+  if type.is_a? Array
+    type.each { |item| raise ArgumentError, "All members of type must be Class objects" unless item.is_a? Class }
+    @allowed_types = type
+  else
+    raise ArgumentError, "Type must be a Class object or array of Class objects" unless type.is_a? Class
+    @allowed_types = [type]
+  end
+  @list = []
+  @locked_at = nil
+  @serialize_as = serialize_as
+end
+
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + - (Object) method_missing(meth, *args, &block) + + + +

+
+ +
+ Note: +

+the following methods are not allowed +

+
+ :replace
+ :insert
+ :collect!
+ :map!
+ :pop
+ :delete_if
+ :reverse!
+ :shift
+ :shuffle!
+ :slice!
+ :sort!
+ :uniq!
+ :unshift
+ :zip
+ :flatten!
+ :fill
+ :drop
+ :drop_while
+ :delete_if
+ :clear
+ :concat
+
+
+
+ +

+method_mission override to pass allowed methods to the list. +

+ + +
+
+
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+127
+128
+129
+130
+131
+132
+133
+134
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 127
+
+def method_missing(meth, *args, &block)
+  raise ArgumentError, "#{meth} not supported" if [:replace, :insert, :collect!, :map!, :pop, :delete_if, :reverse!, :shift, :shuffle!, :slice!, :sort!, :uniq!, :unshift, :zip, :flatten!, :fill, :drop, :drop_while, :delete_if, :clear, :concat].include? meth.to_sym        
+  if @list.respond_to? meth
+    @list.send(meth, *args, &block)      
+  else
+    super
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Array) allowed_types (readonly) + + + +

+
+

+The class constants of allowed types +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +
+ + + + +
+
+
+
+7
+8
+9
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 7
+
+def allowed_types
+  @allowed_types
+end
+
+
+
+ + + + +
+

+ + - (Integer) locked_at (readonly) + + + +

+
+

+The index below which items cannot be removed +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 11
+
+def locked_at
+  @locked_at
+end
+
+
+
+ + + + +
+

+ + - (String) serialize_as (readonly) + + + +

+
+

+The tag name to use when serializing this object by default the parent node +for all items in the list is the classname of the first allowed type with +the first letter in lowercase. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 16
+
+def serialize_as
+  @serialize_as
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Integer) <<(v) + + + +

+
+

+Concat operator +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +the data to be added +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    +returns the index of the item added. +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if the value being added is not one fo the allowed types +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+53
+54
+55
+56
+57
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 53
+
+def <<(v)
+  DataTypeValidator.validate "SimpleTypedList.<<", @allowed_types, v
+  @list << v
+  @list.size - 1      
+end
+
+
+
+ +
+

+ + - (Object) []=(index, v) + + + +

+
+

+positional assignment. Adds the item at the index specified +

+ + +
+
+
+

Parameters:

+
    + +
  • + + index + + + (Integer) + + + +
  • + +
  • + + v + + + (Any) + + + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if the index is protected by locking +

    +
    + +
  • + +
  • + + + (ArgumentError) + + + + — +

    +if the item is not one of the allowed types +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+89
+90
+91
+92
+93
+94
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 89
+
+def []=(index, v)
+  DataTypeValidator.validate "SimpleTypedList.<<", @allowed_types, v
+  raise ArgumentError, "Item is protected and cannot be changed" if protected? index
+  @list[index] = v
+  v
+end
+
+
+
+ +
+

+ + - (Any) delete(v) + + + +

+
+

+delete the item from the list +

+ + +
+
+
+

Parameters:

+
    + +
  • + + v + + + (Any) + + + + — +

    +The item to be deleted. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Any) + + + + — +

    +The item deleted +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if the item’s index is protected by locking +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+69
+70
+71
+72
+73
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 69
+
+def delete(v)
+  return unless @list.include? v
+  raise ArgumentError, "Item is protected and cannot be deleted" if protected? @list.index(v)
+  @list.delete v
+end
+
+
+
+ +
+

+ + - (Any) delete_at(index) + + + +

+
+

+delete the item from the list at the index position provided +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Any) + + + + — +

    +The item deleted +

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if the index is protected by locking +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+78
+79
+80
+81
+82
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 78
+
+def delete_at(index)
+  @list[index]
+  raise ArgumentError, "Item is protected and cannot be deleted" if protected? index
+  @list.delete_at index
+end
+
+
+
+ +
+

+ + - (self) lock + + + +

+
+

+Lock this list at the current size +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+40
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 37
+
+def lock
+  @locked_at = @list.size
+  self
+end
+
+
+
+ +
+

+ + - (Boolean) protected?(index) + + + +

+
+

+determines if the index is protected +

+ + +
+
+
+

Parameters:

+
    + +
  • + + index + + + (Integer) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+98
+99
+100
+101
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 98
+
+def protected? index
+  return false unless @locked_at.is_a? Fixnum
+  index < @locked_at
+end
+
+
+
+ +
+

+ + - (Object) push(v) + + + +

+
+

+alternate of << method +

+ + +
+
+
+ + +

See Also:

+
    + +
  • <<
  • + +
+ +
+ + + + +
+
+
+
+61
+62
+63
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 61
+
+def push(v)
+  self.<< v
+end
+
+
+
+ +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the list If the serialize_as property is set, it is used as the +parent node name. If the serialize_as property is nil, the first item in +the list of allowed_types will be used, having the first letter of the +class changed to lower case. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+141
+142
+143
+144
+145
+146
+147
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 141
+
+def to_xml(xml)
+  classname = @allowed_types[0].name.split('::').last
+  el_name = serialize_as || (classname[0,1].downcase + classname[1..-1]).pluralize
+  xml.send(el_name, :count=>@list.size) {
+    @list.each { |item| item.to_xml(xml) }
+  }
+end
+
+
+
+ +
+

+ + - (self) unlock + + + +

+
+

+Unlock the list +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+47
+
+
# File 'lib/axlsx/util/simple_typed_list.rb', line 44
+
+def unlock
+  @locked_at = nil
+  self
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Styles.html b/doc/Axlsx/Styles.html new file mode 100644 index 00000000..4182db05 --- /dev/null +++ b/doc/Axlsx/Styles.html @@ -0,0 +1,1754 @@ + + + + + + Class: Axlsx::Styles + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Styles + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/styles.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The Styles class manages worksheet styles In addition to creating the +require style objects for a valid xlsx package, this class provides the key +mechanism for adding styles to your workbook, and safely applying them to +the cells of your worksheet. All portions of the stylesheet are implemented +here exception colors, which specify legacy and modified pallete colors, +and exLst, whic is used as a future feature data storage area. +

+ + +
+
+
+ + +

See Also:

+
    + +
  • Open XML Part 1 18.8.11 for gory details on how this stuff gets put together
  • + +
  • #add_style
  • + +
+ +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Styles) initialize + + + +

+
+

+Creates a new Styles object and prepopulates it with the requires objects +to generate a valid package style part. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+118
+119
+120
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 118
+
+def initialize()
+  load_default_styles
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (SimpleTypedList) borders (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of borders used in this workbook Axlsx predefines +THIN_BORDER which can be used to put a border around all of your cells. +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+85
+86
+87
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 85
+
+def borders
+  @borders
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) cellStyles (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of named styles, referencing cellStyleXfs items in the +workbook. +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+97
+98
+99
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 97
+
+def cellStyles
+  @cellStyles
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) cellStyleXfs (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of master formatting records for named cell styles, which +means records defined in cellStyles, in the workbook +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 91
+
+def cellStyleXfs
+  @cellStyleXfs
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) cellXfs (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of master formatting records. This is the list that you will +actually use in styling a workbook. +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+103
+104
+105
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 103
+
+def cellXfs
+  @cellXfs
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) dxfs (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of non-cell formatting records used in the worksheet. +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+109
+110
+111
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 109
+
+def dxfs
+  @dxfs
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) fills (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of fills used in this workbook +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+78
+79
+80
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 78
+
+def fills
+  @fills
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) fonts (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of fonts used in this workbook +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+72
+73
+74
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 72
+
+def fonts
+  @fonts
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) numFmts (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+numFmts for your styles. +

+
+ The default styles, which change based on the system local, are as follows.
+ id formatCode
+  0 General
+  1 0
+  2 0.00
+  3 #,##0
+  4 #,##0.00
+  9 0%
+  10 0.00%
+  11 0.00E+00
+  12 #   ?/?
+  13 #   ??/??
+  14 mm-dd-yy
+  15 d-mmm-yy
+  16 d-mmm
+  17 mmm-yy
+  18 h:mm AM/PM
+  19 h:mm:ss AM/PM
+  20 h:mm
+  21 h:mm:ss
+  22 m/d/yy h:mm
+  37 #,##0 ;(#,##0)
+  38 #,##0 ;[Red](#,##0)
+  39 #,##0.00;(#,##0.00)
+  40 #,##0.00;[Red](#,##0.00)
+  45 mm:ss
+  46 [h]:mm:ss
+  47 mmss.0
+  48 ##0.0E+0
+  49 @
+ Axlsx also defines the following constants which you can use in add_style.
+    NUM_FMT_PERCENT formats to "0%"
+    NUM_FMT_YYYYMMDD formats to "yyyy/mm/dd"
+    NUM_FMT_YYYYMMDDHHMMSS  formats to "yyyy/mm/dd hh:mm:ss"
+
+ + +
+
+
+ +

Returns:

+ + +

See Also:

+
    + +
  • Open XML Part 1 - 18.8.31 for more information on creating number formats
  • + +
  • #add_style
  • + +
+ +
+ + + + +
+
+
+
+66
+67
+68
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 66
+
+def numFmts
+  @numFmts
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) tableStyles (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is with add_style +

+
+
+ +

+The collection of table styles that will be available to the user in the +excel UI +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+115
+116
+117
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 115
+
+def tableStyles
+  @tableStyles
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Integer) add_style(options = {}) + + + +

+
+

+Drastically simplifies style creation and management. +

+ + +
+
+
+ +
+

Examples:

+ +

+You Got Style +

+

+
require "rubygems" # if that is your preferred way to manage gems!
+require "axlsx"
+
+p = Axlsx::Package.new
+ws = p.workbook.add_worksheet
+
+# black text on a white background at 14pt with thin borders!
+title = ws.style.add_style(:bg_color => "FFFF0000", :fg_color=>"#FF000000", :sz=>14,  :border=>Axlsx::STYLE_THIN_BORDER
+
+ws.add_row :values => ["Least Popular Pets"]
+ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"], :style=>title
+ws.add_row :values => ["Votes", 6, 4, 1], :style=>Axlsx::STYLE_THIN_BORDER
+f = File.open('example_you_got_style.xlsx', 'w')
+p.serialize(f)
+
+ +

+Styling specifically +

+

+
# an example of applying specific styles to specific cells
+require "rubygems" # if that is your preferred way to manage gems!
+require "axlsx"
+
+p = Axlsx::Package.new
+ws = p.workbook.add_worksheet
+
+# define your styles
+title = ws.style.add_style(:bg_color => "FFFF0000", 
+                           :fg_color=>"#FF000000",
+                           :border=>Axlsx::STYLE_THIN_BORDER, 
+                           :alignment=>{:horizontal => :center})
+
+date_time = ws.style.add_style(:num_fmt => Axlsx::NUM_FMT_YYYYMMDDHHMMSS,
+                               :border=>Axlsx::STYLE_THIN_BORDER)
+
+percent = ws.style.add_style(:num_fmt => Axlsx::NUM_FMT_PERCENT, 
+                             :border=>Axlsx::STYLE_THIN_BORDER)
+
+currency = ws.style.add_style(:format_code=>"Â¥#,##0;[Red]Â¥-#,##0",
+                              :border=>Axlsx::STYLE_THIN_BORDER)
+
+# build your rows
+ws.add_row :values => ["Genreated At:", Time.now], :styles=>[nil, date_time]
+ws.add_row :values => ["Previous Year Quarterly Profits (JPY)"], :style=>title
+ws.add_row :values => ["Quarter", "Profit", "% of Total"], :style=>title
+ws.add_row :values => ["Q1", 4000, 40], :style=>[title, currency, percent]
+ws.add_row :values => ["Q2", 3000, 30], :style=>[title, currency, percent]
+ws.add_row :values => ["Q3", 1000, 10], :style=>[title, currency, percent]
+ws.add_row :values => ["Q4", 2000, 20], :style=>[title, currency, percent]
+f = File.open('example_you_got_style.xlsx', 'w')
+p.serialize(f)
+
+ +
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + fg_color + (String) + + + + —

    +The text color +

    +
    +
  • + +
  • + sz + (Integer) + + + + —

    +The text size +

    +
    +
  • + +
  • + b + (Boolean) + + + + —

    +Indicates if the text should be bold +

    +
    +
  • + +
  • + i + (Boolean) + + + + —

    +Indicates if the text should be italicised +

    +
    +
  • + +
  • + strike + (Boolean) + + + + —

    +Indicates if the text should be rendered with a strikethrough +

    +
    +
  • + +
  • + strike + (Boolean) + + + + —

    +Indicates if the text should be rendered with a shadow +

    +
    +
  • + +
  • + charset + (Integer) + + + + —

    +The character set to use. +

    +
    +
  • + +
  • + family + (Integer) + + + + —

    +The font family to use. +

    +
    +
  • + +
  • + name + (String) + + + + —

    +The name of the font to use +

    +
    +
  • + +
  • + num_fmt + (Integer) + + + + —

    +The number format to apply +

    +
    +
  • + +
  • + format_code + (String) + + + + —

    +The formatting to apply. If this is specified, num_fmt is ignored. +

    +
    +
  • + +
  • + border + (Integer) + + + + —

    +The border style to use. +

    +
    +
  • + +
  • + bg_color + (String) + + + + —

    +The background color to apply to the cell +

    +
    +
  • + +
  • + hidden + (Boolean) + + + + —

    +Indicates if the cell should be hidden +

    +
    +
  • + +
  • + locked + (Boolean) + + + + —

    +Indicates if the cell should be locked +

    +
    +
  • + +
  • + alignment + (Hash) + + + + —

    +A hash defining any of the attributes used in CellAlignment +

    +
    +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 191
+
+def add_style(options={})
+ 
+ numFmtId = if options[:format_code]
+              n = @numFmts.map{ |f| f.numFmtId }.max + 1
+              numFmts << NumFmt.new(:numFmtId => n, :formatCode=> options[:format_code])
+              n
+            else
+              options[:num_fmt] || 0
+            end
+
+ borderId = options[:border] || 0
+ raise ArgumentError, "Invalid borderId" unless borderId < borders.size
+
+ fill = if options[:bg_color]
+          color = Color.new(:rgb=>options[:bg_color])
+          pattern = PatternFill.new(:patternType =>:solid, :fgColor=>color)
+          fills << Fill.new(pattern)   
+        else
+          0
+        end
+
+ fontId = if (options.values_at(:fg_color, :sz, :b, :i, :strike, :outline, :shadow, :charset, :family, :font_name).length)
+            font = Font.new()
+            [:b, :i, :strike, :outline, :shadow, :charset, :family, :sz].each { |k| font.send("#{k}=", options[k]) unless options[k].nil? }
+            font.color = Color.new(:rgb => options[:fg_color]) unless options[:fg_color].nil?
+            font.name = options[:font_name] unless options[:font_name].nil?
+            fonts << font
+          else
+            0 
+          end
+
+  applyProtection = (options[:hidden] || options[:locked]) ? 1 : 0
+  
+ xf = Xf.new(:fillId => fill, :fontId=>fontId, :applyFill=>1, :applyFont=>1, :numFmtId=>numFmtId, :borderId=>borderId, :applyProtection=>applyProtection)
+
+ if options[:alignment]
+   xf.alignment = CellAlignment.new(options[:alignment])
+ end
+ 
+ if applyProtection
+   xf.protection = CellProtection.new(options)
+ end
+
+ cellXfs << xf
+end
+
+
+
+ +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the styles document +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+
+
# File 'lib/axlsx/stylesheet/styles.rb', line 239
+
+def to_xml()
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.styleSheet(:xmlns => XML_NS) {
+      [:numFmts, :fonts, :fills, :borders, :cellStyleXfs, :cellXfs, :dxfs, :tableStyles].each do |key|
+        self.instance_values[key.to_s].to_xml(xml)
+      end
+    }
+  end
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/TableStyle.html b/doc/Axlsx/TableStyle.html new file mode 100644 index 00000000..99a4846c --- /dev/null +++ b/doc/Axlsx/TableStyle.html @@ -0,0 +1,710 @@ + + + + + + Class: Axlsx::TableStyle + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::TableStyle + + + +

+ +
+ +
Inherits:
+
+ SimpleTypedList + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/table_style.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Table are not supported in this version and only the defaults required for +a valid workbook are created. +

+
+
+ +

+A single table style definition and is a collection for tableStyleElements +

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from SimpleTypedList

+

allowed_types, locked_at, serialize_as

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from SimpleTypedList

+

#<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

+
+

Constructor Details

+ +
+

+ + - (TableStyle) initialize(name, options = {}) + + + +

+
+

+creates a new TableStyle object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + pivot + (Boolean) + + + + +
  • + +
  • + table + (Boolean) + + + + +
  • + +
+ + +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +if name option is not provided. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/axlsx/stylesheet/table_style.rb', line 23
+
+def initialize(name, options={})
+  self.name = name
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+  super TableStyleElement
+end
+
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class Axlsx::SimpleTypedList + +

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (string) name + + + +

+
+

+The name of this table style +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (string) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/stylesheet/table_style.rb', line 8
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Boolean) pivot + + + +

+
+

+indicates if this style should be applied to pivot tables +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/axlsx/stylesheet/table_style.rb', line 12
+
+def pivot
+  @pivot
+end
+
+
+
+ + + + +
+

+ + - (Boolean) table + + + +

+
+

+indicates if this style should be applied to tables +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/axlsx/stylesheet/table_style.rb', line 16
+
+def table
+  @table
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the table style +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+41
+42
+
+
# File 'lib/axlsx/stylesheet/table_style.rb', line 38
+
+def to_xml(xml)
+  attr = self.instance_values.select { |k, v| [:name, :pivot, :table].include? k }
+  attr[:count] = self.size
+  xml.tableStyle(attr) { self.each { |table_style_el| table_style_el.to_xml(xml) } }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/TableStyleElement.html b/doc/Axlsx/TableStyleElement.html new file mode 100644 index 00000000..d062d012 --- /dev/null +++ b/doc/Axlsx/TableStyleElement.html @@ -0,0 +1,677 @@ + + + + + + Class: Axlsx::TableStyleElement + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::TableStyleElement + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/table_style_element.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+tables and table styles are not supported in this version. This class +exists in preparation for that support. +

+
+
+ +

+an element of style that belongs to a table style. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (TableStyleElement) initialize(options = {}) + + + +

+
+

+creates a new TableStyleElement object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + type + (Symbol) + + + + +
  • + +
  • + size + (Integer) + + + + +
  • + +
  • + dxfId + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+49
+50
+51
+52
+53
+
+
# File 'lib/axlsx/stylesheet/table_style_element.rb', line 49
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Integer) dxfId + + + +

+
+

+The dxfId this style element points to +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+
+
# File 'lib/axlsx/stylesheet/table_style_element.rb', line 43
+
+def dxfId
+  @dxfId
+end
+
+
+
+ + + + +
+

+ + - (Integer) size + + + +

+
+

+Number of rows or columns used in striping when the type is firstRowStripe, +secondRowStripe, firstColumnStripe, or secondColumnStripe. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+
+
# File 'lib/axlsx/stylesheet/table_style_element.rb', line 39
+
+def size
+  @size
+end
+
+
+
+ + + + +
+

+ + - (Symbol) type + + + +

+
+

+The type of style element. The following type are allowed +

+
+  :wholeTable
+  :headerRow
+  :totalRow
+  :firstColumn
+  :lastColumn
+  :firstRowStripe
+  :secondRowStripe
+  :firstColumnStripe
+  :secondColumnStripe
+  :firstHeaderCell
+  :lastHeaderCell
+  :firstTotalCell
+  :lastTotalCell
+  :firstSubtotalColumn
+  :secondSubtotalColumn
+  :thirdSubtotalColumn
+  :firstSubtotalRow
+  :secondSubtotalRow
+  :thirdSubtotalRow
+  :blankRow
+  :firstColumnSubheading
+  :secondColumnSubheading
+  :thirdColumnSubheading
+  :firstRowSubheading
+  :secondRowSubheading
+  :thirdRowSubheading
+  :pageFieldLabels
+  :pageFieldValues
+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/axlsx/stylesheet/table_style_element.rb', line 35
+
+def type
+  @type
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the table style element +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/axlsx/stylesheet/table_style_element.rb', line 62
+
+def to_xml(xml)
+  xml.tableStyleElement self.instance_values
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/TableStyles.html b/doc/Axlsx/TableStyles.html new file mode 100644 index 00000000..c66b002c --- /dev/null +++ b/doc/Axlsx/TableStyles.html @@ -0,0 +1,599 @@ + + + + + + Class: Axlsx::TableStyles + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::TableStyles + + + +

+ +
+ +
Inherits:
+
+ SimpleTypedList + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/table_styles.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+Support for custom table styles does not exist in this version. Many of the +classes required are defined in preparation for future release. Please do +not attempt to add custom table styles. +

+
+
+ +

+TableStyles represents a collection of style definitions for table styles +and pivot table styles. +

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from SimpleTypedList

+

allowed_types, locked_at, serialize_as

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from SimpleTypedList

+

#<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

+
+

Constructor Details

+ +
+

+ + - (TableStyles) initialize(options = {}) + + + +

+
+

+Creates a new TableStyles object that is a container for TableStyle objects +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + defaultTableStyle + (String) + + + + +
  • + +
  • + defaultPivotStyle + (String) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+
+
# File 'lib/axlsx/stylesheet/table_styles.rb', line 18
+
+def initialize(options={})
+  @defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
+  @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"      
+  super TableStyle
+end
+
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class Axlsx::SimpleTypedList + +

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) defaultPivotStyle + + + +

+
+

+The default pivot table style. The default value is +‘PivotStyleLight6’ +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/stylesheet/table_styles.rb', line 13
+
+def defaultPivotStyle
+  @defaultPivotStyle
+end
+
+
+
+ + + + +
+

+ + - (String) defaultTableStyle + + + +

+
+

+The default table style. The default value is +‘TableStyleMedium9’ +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/stylesheet/table_styles.rb', line 9
+
+def defaultTableStyle
+  @defaultTableStyle
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the table styles element +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+
+
# File 'lib/axlsx/stylesheet/table_styles.rb', line 30
+
+def to_xml(xml)
+  attr = self.instance_values.reject {|k, v| ![:defaultTableStyle, :defaultPivotStyle].include?(k.to_sym) }
+  attr[:count] = self.size
+  xml.tableStyles(attr) {
+    self.each { |table_style| table_style.to_xml(xml) }
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Title.html b/doc/Axlsx/Title.html new file mode 100644 index 00000000..678c2837 --- /dev/null +++ b/doc/Axlsx/Title.html @@ -0,0 +1,621 @@ + + + + + + Class: Axlsx::Title + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Title + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/title.rb
+ +
+
+ +

Overview

+
+

+A Title stores information about the title of a chart +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Title) initialize(title = "") + + + +

+
+

+Creates a new Title object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + title + + + (String, Cell) + + + (defaults to: "") + + + — +

    +The cell or string to be used for the chart’s title +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+15
+16
+17
+18
+
+
# File 'lib/axlsx/drawing/title.rb', line 15
+
+def initialize(title="")
+  self.cell = title if title.is_a?(Cell)
+  self.text = title.to_s unless title.is_a?(Cell)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Cell) cell + + + +

+
+

+The cell that holds the text for the title. Setting this property will +automatically update the text attribute. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Cell) + + + +
  • + +
+ +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/axlsx/drawing/title.rb', line 11
+
+def cell
+  @cell
+end
+
+
+
+ + + + +
+

+ + - (String) text + + + +

+
+

+The text to be shown. Setting this property directly with a string will +remove the cell reference. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+7
+8
+9
+
+
# File 'lib/axlsx/drawing/title.rb', line 7
+
+def text
+  @text
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) range + + + +

+
+

+returns the excel style abslute reference for the title when title is a +Cell object +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+63
+64
+65
+66
+
+
# File 'lib/axlsx/drawing/title.rb', line 63
+
+def range
+  return "" unless @data.is_a?(Cell)
+  "#{@data.row.worksheet.name}!#{data.row.r_abs}"
+end
+
+
+
+ +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the chart title +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
+
# File 'lib/axlsx/drawing/title.rb', line 43
+
+def to_xml(xml)
+  xml.send('c:title') {
+    xml.send('c:tx') {
+      xml.send('c:strRef') {
+        xml.send('c:f', range)
+        xml.send('c:strCache') {
+          xml.send('c:ptCount', :val=>1)
+          xml.send('c:pt', :idx=>0) {
+            xml.send('c:v', @text)
+          }
+        }
+      }
+    }
+  }      
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/TwoCellAnchor.html b/doc/Axlsx/TwoCellAnchor.html new file mode 100644 index 00000000..a55c9ded --- /dev/null +++ b/doc/Axlsx/TwoCellAnchor.html @@ -0,0 +1,1115 @@ + + + + + + Class: Axlsx::TwoCellAnchor + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::TwoCellAnchor + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/two_cell_anchor.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

+The recommended way to manage drawings and charts is Worksheet#add_chart. +Anchors are specified by the :start_at and :end_at options to that method. +

+
+
+ +

+This class details the anchor points for drawings. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (TwoCellAnchor) initialize(drawing, chart_type, options) + + + +

+
+

+Creates a new TwoCellAnchor object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + drawing + + + (Drawing) + + + +
  • + +
  • + + chart + + + (Chart) + + + +
  • + +
  • + + options + + + (Hash) + + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (options):

+
    + +
  • + start_at + (Array) + + + + +
  • + +
  • + end_at + (Array) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 31
+
+def initialize(drawing, chart_type, options)
+  @drawing = drawing
+  drawing.anchors << self      
+
+  @from, @to =  Marker.new, Marker.new(:col => 5, :row=>10)
+  @graphic_frame = GraphicFrame.new(self, chart_type, options)
+
+  self.start_at(options[:start_at][0], options[:start_at][1]) if options[:start_at].is_a?(Array)
+  self.end_at(options[:end_at][0], options[:end_at][1]) if options[:end_at].is_a?(Array)
+  # passing a reference to our start and end markers for convenience
+  # this lets us access the markers directly from the chart.
+  @graphic_frame.chart.send(:start_at=, @from)
+  @graphic_frame.chart.send(:end_at=, @to)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Drawing) drawing (readonly) + + + +

+
+

+The drawing that holds this anchor +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 20
+
+def drawing
+  @drawing
+end
+
+
+
+ + + + +
+

+ + - (Marker) from (readonly) + + + +

+
+

+A marker that defines the from cell anchor. The default from column and row +are 0 and 0 respectively +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Marker) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 9
+
+def from
+  @from
+end
+
+
+
+ + + + +
+

+ + - (GraphicFrame) graphic_frame (readonly) + + + +

+
+

+The frame for your chart +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 16
+
+def graphic_frame
+  @graphic_frame
+end
+
+
+
+ + + + +
+

+ + - (Integer) index (readonly) + + + +

+
+

+The index of this anchor in the drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 24
+
+def index
+  @drawing.anchors.index(self)
+end
+
+
+
+ + + + +
+

+ + - (Marker) to (readonly) + + + +

+
+

+A marker that returns the to cell anchor. The default to column and row are +5 and 10 respectively +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Marker) + + + +
  • + +
+ +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 12
+
+def to
+  @to
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Marker) end_at(x, y) + + + +

+
+

+This is a short cut method to set the end anchor position +

+ + +
+
+
+

Parameters:

+
    + +
  • + + x + + + (Integer) + + + + — +

    +The column +

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +

    +The row +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Marker) + + + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+68
+69
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 65
+
+def end_at(x, y)
+  @to.col = x
+  @to.row = y
+  @to
+end
+
+
+
+ +
+

+ + - (Marker) start_at(x, y) + + + +

+
+

+This is a short cut method to set the start anchor position +

+ + +
+
+
+

Parameters:

+
    + +
  • + + x + + + (Integer) + + + + — +

    +The column +

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +

    +The row +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Marker) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 55
+
+def start_at(x, y)
+  @from.col = x
+  @from.row = y
+  @from
+end
+
+
+
+ +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the two cell anchor +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/axlsx/drawing/two_cell_anchor.rb', line 74
+
+def to_xml(xml)
+  #build it for now, break it down later!
+  xml.send('xdr:twoCellAnchor') {
+    xml.send('xdr:from') {
+      from.to_xml(xml)
+    }
+    xml.send('xdr:to') {
+      to.to_xml(xml)
+    }
+    @graphic_frame.to_xml(xml)
+    xml.send('xdr:clientData')
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/ValAxis.html b/doc/Axlsx/ValAxis.html new file mode 100644 index 00000000..13a9ea9a --- /dev/null +++ b/doc/Axlsx/ValAxis.html @@ -0,0 +1,539 @@ + + + + + + Class: Axlsx::ValAxis + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::ValAxis + + + +

+ +
+ +
Inherits:
+
+ Axis + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/val_axis.rb
+ +
+
+ +

Overview

+
+

+the ValAxis class defines a chart value axis. +

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + + + + +

Attributes inherited from Axis

+

axId, axPos, crossAx, crosses, format_code, scaling, tickLblPos

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + +
+

Constructor Details

+ +
+

+ + - (ValAxis) initialize(axId, crossAx, options = {}) + + + +

+
+

+Creates a new ValAxis object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + axId + + + (Integer) + + + + — +

    +the id of this axis +

    +
    + +
  • + +
  • + + crossAx + + + (Integer) + + + + — +

    +the id of the perpendicular axis +

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (options):

+
    + +
  • + axPos + (Symbol) + + + + +
  • + +
  • + crosses + (Symbol) + + + + +
  • + +
  • + tickLblPos + (Symbol) + + + + +
  • + +
  • + crossesBetween + (Symbol) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+17
+18
+19
+20
+
+
# File 'lib/axlsx/drawing/val_axis.rb', line 17
+
+def initialize(axId, crossAx, options={})
+  @crossBetween = :between
+  super(axId, crossAx, options)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Symbol) crossBetween + + + +

+
+

+This element specifies whether the value axis crosses the category axis +between categories. must be one of [:between, :midCat] +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/axlsx/drawing/val_axis.rb', line 8
+
+def crossBetween
+  @crossBetween
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the value axis +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+30
+31
+32
+
+
# File 'lib/axlsx/drawing/val_axis.rb', line 27
+
+def to_xml(xml)
+  xml.send('c:valAx') {
+    super(xml)
+    xml.send('c:crossBetween', :val=>@crossBetween)
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/View3D.html b/doc/Axlsx/View3D.html new file mode 100644 index 00000000..e42b3bbc --- /dev/null +++ b/doc/Axlsx/View3D.html @@ -0,0 +1,971 @@ + + + + + + Class: Axlsx::View3D + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::View3D + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/view_3D.rb
+ +
+
+ +

Overview

+
+

+3D attributes for a chart. +

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
H_PERCENT_REGEX = +
+
+

+Validation for hPercent +

+ + +
+
+
+ + +
+
+
/0*(([5-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
+
+ +
DEPTH_PERCENT_REGEX = +
+
+

+validation for depthPercent +

+ + +
+
+
+ + +
+
+
/0*(([2-9][0-9])|([1-9][0-9][0-9])|(1[0-9][0-9][0-9])|2000)%/
+
+ +
+ + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (View3D) initialize(options = {}) + + + +

+
+

+Creates a new View3D for charts +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + rotX + (Integer) + + + + +
  • + +
  • + hPercent + (String) + + + + +
  • + +
  • + rotY + (Integer) + + + + +
  • + +
  • + depthPercent + (String) + + + + +
  • + +
  • + rAngAx + (Boolean) + + + + +
  • + +
  • + perspective + (Integer) + + + + +
  • + +
+ + + +
+ + + + +
+
+
+
+39
+40
+41
+42
+43
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 39
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end    
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (String) depthPercent + + + +

+
+

+depth or chart as % of chart width must be between 20% and 2000% +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 22
+
+def depthPercent
+  @depthPercent
+end
+
+
+
+ + + + +
+

+ + - (String) hPercent + + + +

+
+

+height of chart as % of chart must be between 5% and 500% +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 12
+
+def hPercent
+  @hPercent
+end
+
+
+
+ + + + +
+

+ + - (Integer) perspective + + + +

+
+

+field of view angle +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 30
+
+def perspective
+  @perspective
+end
+
+
+
+ + + + +
+

+ + - (Boolean) rAngAx + + + +

+
+

+Chart axis are at right angles +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 26
+
+def rAngAx
+  @rAngAx
+end
+
+
+
+ + + + +
+

+ + - (Integer) rotX + + + +

+
+

+x rotation for the chart must be between -90 and 90 +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+7
+8
+9
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 7
+
+def rotX
+  @rotX
+end
+
+
+
+ + + + +
+

+ + - (Integer) rotY + + + +

+
+

+y rotation for the chart must be between 0 and 360 +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 17
+
+def rotY
+  @rotY
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the view3D properties +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+
+
# File 'lib/axlsx/drawing/view_3D.rb', line 61
+
+def to_xml(xml)
+  xml.send('c:view3D') {
+    xml.send('c:rotX', :val=>@rotX) unless @rotX.nil?
+    xml.send('c:hPercent', :val=>@hPercent) unless @hPercent.nil?
+    xml.send('c:rotY', :val=>@rotY) unless @rotY.nil?
+    xml.send('c:depthPercent', :val=>@depthPercent) unless @depthPercent.nil?
+    xml.send('c:rAngAx', :val=>@rAngAx) unless @rAngAx.nil?
+    xml.send('c:perspective', :val=>@perspective) unless @perspective.nil?
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Workbook.html b/doc/Axlsx/Workbook.html new file mode 100644 index 00000000..2e7b8aa6 --- /dev/null +++ b/doc/Axlsx/Workbook.html @@ -0,0 +1,1347 @@ + + + + + + Class: Axlsx::Workbook + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Workbook + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/workbook/workbook.rb
+ +
+
+ +

Overview

+
+

+The Workbook class is an xlsx workbook that manages worksheets, charts, +drawings and styles. The following parts of the Office Open XML spreadsheet +specification are not implimented in this version. +

+
+  bookViews
+  calcPr
+  customWorkbookViews
+  definedNames
+  externalReferences
+  extLst
+  fileRecoveryPr
+  fileSharing
+  fileVersion
+  functionGroups
+  oleSize
+  pivotCaches
+  smartTagPr
+  smartTagTypes
+  webPublishing
+  webPublishObjects
+  workbookProtection
+  workbookPr*
+
+  *workbookPr is only supported to the extend of date1904
+
+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
@@date1904 = +
+
+

+Indicates if the epoc date for serialization should be 1904. If false, 1900 +is used. +

+ + +
+
+
+ + +
+
+
false
+
+ +
+ + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Workbook) initialize(options = {}) {|_self| ... } + + + +

+
+

+Creates a new Workbook +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + date1904 + (Boolean) + + + + +
  • + +
+ + +

Yields:

+
    + +
  • + + + (_self) + + + +
  • + +
+

Yield Parameters:

+
    + +
  • + + _self + + + (Axlsx::Workbook) + + + + — +

    +the object that the method was called on +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 75
+
+def initialize(options={})
+  @styles = Styles.new
+  @worksheets = SimpleTypedList.new Worksheet
+  @drawings = SimpleTypedList.new Drawing
+  @charts = SimpleTypedList.new Chart
+  self.date1904= options[:date1904] unless options[:date1904].nil?
+  yield self if block_given?      
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (SimpleTypedList) charts (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage charts is Worksheet#add_chart +

+
+
+ +

+A colllection of charts associated with this workbook +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+45
+46
+47
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 45
+
+def charts
+  @charts
+end
+
+
+
+ + + + +
+

+ + - (Boolean) date1904 + + + +

+
+

+Instance level access to the class variable 1904 +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+67
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 67
+
+def date1904() @@date1904; end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) drawings (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage drawings is Worksheet#add_chart +

+
+
+ +

+A colllection of drawings associated with this workbook +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+52
+53
+54
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 52
+
+def drawings
+  @drawings
+end
+
+
+
+ + + + +
+

+ + - (Relationships) relationships (readonly) + + + +

+
+

+The workbook relationships. This is managed automatically by the workbook +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+63
+64
+65
+66
+67
+68
+69
+70
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 63
+
+def relationships
+  r = Relationships.new
+  @worksheets.each do |sheet|
+    r << Relationship.new(WORKSHEET_R, WORKSHEET_PN % (r.size+1))
+  end 
+  r << Relationship.new(STYLES_R,  STYLES_PN)
+  r
+end
+
+
+
+ + + + +
+

+ + - (Styles) styles (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage styles is Styles#add_style +

+
+
+ +

+The styles associated with this workbook +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Styles) + + + +
  • + +
+ +

See Also:

+
    + +
  • Style#add_style
  • + +
  • Style
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 59
+
+def styles
+  @styles
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) worksheets (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage worksheets is add_worksheet +

+
+
+ +

+A collection of worksheets associated with this workbook. +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 38
+
+def worksheets
+  @worksheets
+end
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Boolean) date1904 + + + +

+
+

+retrieves the date1904 attribute +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+93
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 93
+
+def self.date1904() @@date1904; end
+
+
+
+ +
+

+ + + (Boolean) date1904=(v) + + + +

+
+

+Sets the date1904 attribute to the provided boolean +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+89
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 89
+
+def self.date1904=(v) Axlsx::validate_boolean v; @@date1904 = v end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Worksheet) add_worksheet(options = {}) {|worksheet| ... } + + + +

+
+

+Adds a worksheet to this workbook +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + +

Options Hash (options):

+
    + +
  • + name + (String) + + + + —

    +The name of the worksheet. +

    +
    +
  • + +
+ + +

Yields:

+
    + +
  • + + + (worksheet) + + + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+99
+100
+101
+102
+103
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 99
+
+def add_worksheet(options={})
+  worksheet = Worksheet.new(self, options)
+  yield worksheet if block_given?
+  worksheet
+end
+
+
+
+ +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the workbook document +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+
+
# File 'lib/axlsx/workbook/workbook.rb', line 116
+
+def to_xml()
+  add_worksheet unless worksheets.size > 0
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.workbook(:xmlns => XML_NS, :'xmlns:r' => XML_NS_R) {
+      xml.workbookPr(:date1904=>@@date1904)
+      xml.sheets {
+        @worksheets.each_with_index do |sheet, index|              
+          xml.sheet(:name=>sheet.name, :sheetId=>index+1, :"r:id"=>sheet.rId)
+        end
+      }
+    }
+  end      
+  builder.to_xml(:indent=>0)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Worksheet.html b/doc/Axlsx/Worksheet.html new file mode 100644 index 00000000..36a5798c --- /dev/null +++ b/doc/Axlsx/Worksheet.html @@ -0,0 +1,1864 @@ + + + + + + Class: Axlsx::Worksheet + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Worksheet + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/workbook/worksheet/worksheet.rb
+ +
+
+ +

Overview

+
+

+The Worksheet class represents a worksheet in the workbook. +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Worksheet) initialize(wb, options = {}) + + + +

+
+ +
+ Note: +

+the recommended way to manage worksheets is Workbook#add_worksheet +

+
+
+ +

+Creates a new worksheet. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + name + (String) + + + + —

    +The name of this sheet. +

    +
    +
  • + +
+ + + +

See Also:

+ + +
+ + + + +
+
+
+
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 59
+
+def initialize(wb, options={})
+  @rows = SimpleTypedList.new Row
+  self.workbook = wb
+  @workbook.worksheets << self
+  @auto_fit_data = []
+  self.name = options[:name] || "Sheet" + (index+1).to_s
+  @magick_draw = Magick::Draw.new
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Array) auto_fit_data (readonly) + + + +

+
+ +
+ Note: +

+a single auto fit data item is a hash with :longest => [String] and +:sz=> [Integer] members. +

+
+
+ +

+An array of content based calculated column widths. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    +of Hash +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+34
+35
+36
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 34
+
+def auto_fit_data
+  @auto_fit_data
+end
+
+
+
+ + + + +
+

+ + - (Drawing) drawing (readonly) + + + +

+
+ +
+ Note: +

+the recommended way to work with drawings and charts is Worksheet#add_chart +

+
+
+ +

+The drawing associated with this worksheet. +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 29
+
+def drawing
+  @drawing || @drawing = Axlsx::Drawing.new(self)
+end
+
+
+
+ + + + +
+

+ + - (Integer) index (readonly) + + + +

+
+

+The index of this worksheet in the owning Workbook’s worksheets list. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 50
+
+def index
+  @workbook.worksheets.index(self)
+end
+
+
+
+ + + + +
+

+ + - (String) name + + + +

+
+

+The name of the worksheet +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 9
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (String) pn (readonly) + + + +

+
+

+The part name of this worksheet +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 38
+
+def pn
+  "#{WORKSHEET_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (Object) relationships (readonly) + + + +

+
+

+The worksheet’s relationships. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+17
+18
+19
+20
+21
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 17
+
+def relationships
+    r = Relationships.new
+    r << Relationship.new(DRAWING_R, "../#{@drawing.pn}") if @drawing
+    r
+end
+
+
+
+ + + + +
+

+ + - (String) rels_pn (readonly) + + + +

+
+

+The relationship part name of this worksheet +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+42
+43
+44
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 42
+
+def rels_pn
+  "#{WORKSHEET_RELS_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (String) rId (readonly) + + + +

+
+

+The relationship Id of thiw worksheet +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 46
+
+def rId
+  "rId#{index+1}"
+end
+
+
+
+ + + + +
+

+ + - (SimpleTypedList) rows (readonly) + + + +

+
+ +
+ Note: +

+The recommended way to manage rows is Worksheet#add_row +

+
+
+ +

+The rows in this worksheet +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 23
+
+def rows
+  @rows
+end
+
+
+
+ + + + +
+

+ + - (Workbook) workbook + + + +

+
+

+The workbook that owns this worksheet +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 13
+
+def workbook
+  @workbook
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) add_chart(chart_type, options = {}) {|chart| ... } + + + +

+
+

+Adds a chart to this worksheets drawing. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + chart_type + + + (Class) + + + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + start_at + (Array) + + + + +
  • + +
  • + end_at + (Array) + + + + +
  • + +
  • + title + (Cell, String) + + + + +
  • + +
+ + +

Yields:

+
    + +
  • + + + (chart) + + + +
  • + +
+ +
+ + + + +
+
+
+
+108
+109
+110
+111
+112
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 108
+
+def add_chart(chart_type, options={})
+  chart = drawing.add_chart(chart_type, options)
+  yield chart if block_given?
+  chart
+end
+
+
+
+ +
+

+ + - (Row) add_row(values = [], options = {}) {|@rows.last| ... } + + + +

+
+

+Adds a row to the worksheet and updates auto fit data +

+ + +
+
+
+

Parameters:

+
    + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +

Options Hash (options):

+
    + +
  • + values + (Array) + + + + +
  • + +
  • + types + (Array, Symbol) + + + + +
  • + +
  • + style + (Array, Integer) + + + + +
  • + +
+ + +

Yields:

+
    + +
  • + + + (@rows.last) + + + +
  • + +
+

Returns:

+
    + +
  • + + + (Row) + + + +
  • + +
+ +
+ + + + +
+
+
+
+96
+97
+98
+99
+100
+101
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 96
+
+def add_row(values=[], options={})
+  Row.new(self, values, options)
+  update_auto_fit_data @rows.last.cells
+  yield @rows.last if block_given?
+  @rows.last
+end
+
+
+
+ +
+

+ + - (Float) auto_width(col) + + + +

+
+ +
+ Note: +

+From ECMA docs +

+
+ Column width measured as the number of characters of the maximum digit width of the numbers 0 .. 9 as
+ rendered in the normal style's font. There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.
+ width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
+
+
+
+ +

+Determines the proper width for a column based on content. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + A + + + (Hash) + + + + — +

    +hash of auto_fit_data +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 182
+
+def auto_width(col)
+  mdw = 6.0 # maximum digit with is always 6.0 in testable fonts so instead of beating RMagick every time, I am hardcoding it here.
+  mdw_count = 0 
+  best_guess = 1.5  #direct testing shows the results of the documented formula to be a bit too small. This is a best guess scaling
+  font_scale = col[:sz].to_f / (self.workbook.styles.fonts[0].sz.to_f || 11.0)
+  col[:longest].scan(/./mu).each do |i|
+    mdw_count +=1 if @magick_draw.get_type_metrics(i).width >= mdw 
+  end
+  ((mdw_count * mdw + 5) / mdw * 256) / 256.0 * best_guess * font_scale      
+end
+
+
+
+ +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the worksheet document +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 116
+
+def to_xml
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.worksheet(:xmlns => XML_NS, :'xmlns:r' => XML_NS_R) {
+      if @auto_fit_data.size > 0
+        xml.cols {
+          @auto_fit_data.each_with_index do |col, index|
+            min_max = index+1
+            xml.col(:min=>min_max, :max=>min_max, :width => auto_width(col), :customWidth=>"true")
+          end
+        }
+      end
+      xml.sheetData {
+        @rows.each do |row|
+          row.to_xml(xml)
+        end
+      }
+      xml.drawing :"r:id"=>"rId1" if @drawing          
+    }
+  end
+  builder.to_xml(:indent=>0, :save_with=>0)
+end
+
+
+
+ +
+

+ + - (Array) update_auto_fit_data(cells) + + + +

+
+

+Updates auto fit data. Autofit data attempts to determine the cell in a +column that has the greatest width by comparing the length of the text +multiplied by the size of the font. +

+ + +
+
+
+

Parameters:

+
    + +
  • + + cells + + + (Array) + + + + — +

    +an array of cells +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    +of Cell objects +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+
+
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 154
+
+def update_auto_fit_data(cells)
+  styles = self.workbook.styles
+  cellXfs, fonts = styles.cellXfs, styles.fonts
+  sz = fonts[0].sz
+
+  cells.each_with_index do |item, index|
+    col = @auto_fit_data[index] || {:longest=>"", :sz=>sz} 
+    cell_xf = cellXfs[item.style]
+    font = fonts[cell_xf.fontId || 0]
+    sz = font.sz || sz
+
+    if (col[:longest].scan(/./mu).size * col[:sz]) < (item.value.to_s.scan(/./mu).size * sz)
+      col[:sz] =  sz
+      col[:longest] = item.value.to_s
+    end
+    @auto_fit_data[index] = col
+  end
+  cells
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Axlsx/Xf.html b/doc/Axlsx/Xf.html new file mode 100644 index 00000000..45320bb1 --- /dev/null +++ b/doc/Axlsx/Xf.html @@ -0,0 +1,1681 @@ + + + + + + Class: Axlsx::Xf + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Xf + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/stylesheet/xf.rb
+ +
+
+ +

Overview

+
+

+The Xf class defines a formatting record for use in Styles +

+ + +
+
+
+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Xf) initialize(options = {}) + + + +

+
+

+Creates a new Xf object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + [Integer] + + + (Hash) + + + + — +

    +a customizable set of options +

    +
    + +
  • + +
  • + + [Boolean] + + + (Hash) + + + + — +

    +a customizable set of options +

    +
    + +
  • + +
  • + + [CellAlignment] + + + (Hash) + + + + — +

    +a customizable set of options +

    +
    + +
  • + +
  • + + [CellProtection] + + + (Hash) + + + + — +

    +a customizable set of options +

    +
    + +
  • + +
+ + + + + + +
+ + + + +
+
+
+
+84
+85
+86
+87
+88
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 84
+
+def initialize(options={})
+  options.each do |o|
+    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+  end
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (CellAlignment) alignment + + + +

+
+

+The cell alignment for this style +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+9
+10
+11
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 9
+
+def alignment
+  @alignment
+end
+
+
+
+ + + + +
+

+ + - (Boolean) applyAlignment + + + +

+
+

+Indicates if the alignment options should be applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 62
+
+def applyAlignment
+  @applyAlignment
+end
+
+
+
+ + + + +
+

+ + - (Boolean) applyBorder + + + +

+
+

+indicates if the borderId should be applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+58
+59
+60
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 58
+
+def applyBorder
+  @applyBorder
+end
+
+
+
+ + + + +
+

+ + - (Boolean) applyFill + + + +

+
+

+indicates if the fillId should be applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+54
+55
+56
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 54
+
+def applyFill
+  @applyFill
+end
+
+
+
+ + + + +
+

+ + - (Boolean) applyFont + + + +

+
+

+indicates if the fontId should be applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 50
+
+def applyFont
+  @applyFont
+end
+
+
+
+ + + + +
+

+ + - (Boolean) applyNumberFormat + + + +

+
+

+indicates if the numFmtId should be applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 46
+
+def applyNumberFormat
+  @applyNumberFormat
+end
+
+
+
+ + + + +
+

+ + - (Boolean) applyProtection + + + +

+
+

+Indicates if the protection options should be applied +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+66
+67
+68
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 66
+
+def applyProtection
+  @applyProtection
+end
+
+
+
+ + + + +
+

+ + - (Integer) borderId + + + +

+
+

+index (0 based) of the border to be used in this style +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 30
+
+def borderId
+  @borderId
+end
+
+
+
+ + + + +
+

+ + - (Integer) fillId + + + +

+
+

+index (0 based) of the fill to be used in this style +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 26
+
+def fillId
+  @fillId
+end
+
+
+
+ + + + +
+

+ + - (Integer) fontId + + + +

+
+

+index (0 based) of the font to be used in this style +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 22
+
+def fontId
+  @fontId
+end
+
+
+
+ + + + +
+

+ + - (Integer) numFmtId + + + +

+
+

+id of the numFmt to apply to this style +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 18
+
+def numFmtId
+  @numFmtId
+end
+
+
+
+ + + + +
+

+ + - (Boolean) pivotButton + + + +

+
+

+indicates if the cell has a pivot table drop down button +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+42
+43
+44
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 42
+
+def pivotButton
+  @pivotButton
+end
+
+
+
+ + + + +
+

+ + - (CellProtection) protection + + + +

+
+

+The cell protection for this style +

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 14
+
+def protection
+  @protection
+end
+
+
+
+ + + + +
+

+ + - (Boolean) quotePrefix + + + +

+
+

+indecates if text should be prefixed by a single quote in the cell +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 38
+
+def quotePrefix
+  @quotePrefix
+end
+
+
+
+ + + + +
+

+ + - (Integer) xfId + + + +

+
+

+index (0 based) of cellStylesXfs item to be used in this style. Only +applies to cellXfs items +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+34
+35
+36
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 34
+
+def xfId
+  @xfId
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (String) to_xml(xml) + + + +

+
+

+Serializes the xf elemen +

+ + +
+
+
+

Parameters:

+
    + +
  • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

    +The document builder instance this objects xml will be added to. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+110
+111
+112
+113
+114
+115
+
+
# File 'lib/axlsx/stylesheet/xf.rb', line 110
+
+def to_xml(xml)
+  xml.xf(self.instance_values.reject { |k, v| [:alignment, :protection, :extList, :name].include? k.to_sym}) {
+    alignment.to_xml(xml) if self.alignment
+    protection.to_xml(xml) if self.protection
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 00000000..9baa7929 --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,575 @@ + + + + + + Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Documentation by YARD 0.7.3

+
+

Alphabetic Index

+ +

File Listing

+ + +
+

Namespace Listing A-Z

+ + + + + + + + +
+ + +
    +
  • A
  • +
      + +
    • + App + + (Axlsx) + +
    • + +
    • + Axis + + (Axlsx) + +
    • + +
    • + Axlsx + +
    • + +
    +
+ + + + + + + + + + + +
    +
  • F
  • +
      + +
    • + Fill + + (Axlsx) + +
    • + +
    • + Font + + (Axlsx) + +
    • + +
    +
+ + + + + +
    +
  • M
  • +
      + +
    • + Marker + + (Axlsx) + +
    • + +
    +
+ + +
+ + +
    +
  • N
  • +
      + +
    • + NumFmt + + (Axlsx) + +
    • + +
    +
+ + +
    +
  • O
  • + +
+ + + + + + + + + + + + + + +
    +
  • V
  • + +
+ + + + + +
+ + +
    +
  • X
  • +
      + +
    • + Xf + + (Axlsx) + +
    • + +
    +
+ +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/class_list.html b/doc/class_list.html new file mode 100644 index 00000000..088ee65e --- /dev/null +++ b/doc/class_list.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+

Class List

+ + + + +
+ + diff --git a/doc/css/common.css b/doc/css/common.css new file mode 100644 index 00000000..cf25c452 --- /dev/null +++ b/doc/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/doc/css/full_list.css b/doc/css/full_list.css new file mode 100644 index 00000000..3c032964 --- /dev/null +++ b/doc/css/full_list.css @@ -0,0 +1,55 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; } +#full_list ul { padding: 0; } +#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } +#noresults { padding: 7px 12px; } +#content.insearch #noresults { margin-left: 7px; } +ul.collapsed ul, ul.collapsed li { display: none; } +ul.collapsed.search_uncollapsed { display: block; } +ul.collapsed.search_uncollapsed li { display: list-item; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } +li:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a:link, a:visited { text-decoration: none; color: #05a; } +li.clicked { background: #05a; color: #ccc; } +li.clicked a:link, li.clicked a:visited { color: #eee; } +li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } +#nav a:link, #nav a:visited { color: #358; } +#nav a:hover { background: transparent; color: #5af; } + +.frames #content h1 { margin-top: 0; } +.frames li { white-space: nowrap; cursor: normal; } +.frames li small { display: block; font-size: 0.8em; } +.frames li small:before { content: ""; } +.frames li small:after { content: ""; } +.frames li small.search_info { display: none; } +.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +.frames #content.insearch #search { background-position: center right; } +.frames #search input { width: 110px; } +.frames #nav { display: block; } + +#full_list.insearch li { display: none; } +#full_list.insearch li.found { display: list-item; padding-left: 10px; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/doc/css/style.css b/doc/css/style.css new file mode 100644 index 00000000..60829f7e --- /dev/null +++ b/doc/css/style.css @@ -0,0 +1,322 @@ +body { + padding: 0 20px; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; +} +body.frames { padding: 0 5px; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; +} +h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link, .docstring .object_link { font-family: monospace; } +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } + +/* style for