From 11303a4d6664d9a7ff7bc408035d2ab70378a375 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sat, 26 Nov 2011 13:20:57 +0900 Subject: adding in support for ruby 1.9.3 release version 1.0.9 --- .yardoc/checksums | 110 +- .yardoc/objects/root.dat | Bin 452695 -> 445937 bytes .yardoc/proxy_types | Bin 53 -> 69 bytes .yardops | 4 - .yardopts | 4 + CHANGELOG.md | 14 + README.md | 43 +- Rakefile | 2 +- axlsx.gemspec | 40 +- doc/Axlsx.html | 932 ++++++--------- doc/Axlsx/App.html | 617 ++++------ doc/Axlsx/Axis.html | 257 ++-- doc/Axlsx/Bar3DChart.html | 274 ++--- doc/Axlsx/BarSeries.html | 148 ++- doc/Axlsx/Border.html | 215 ++-- doc/Axlsx/BorderPr.html | 203 ++-- doc/Axlsx/CatAxis.html | 183 ++- doc/Axlsx/CatAxisData.html | 94 +- doc/Axlsx/Cell.html | 872 +++----------- doc/Axlsx/CellAlignment.html | 273 ++--- doc/Axlsx/CellProtection.html | 118 +- doc/Axlsx/CellStyle.html | 184 ++- doc/Axlsx/Chart.html | 793 ++++++------- doc/Axlsx/Color.html | 134 +-- doc/Axlsx/ContentType.html | 69 +- doc/Axlsx/Core.html | 98 +- doc/Axlsx/DataTypeValidator.html | 77 +- doc/Axlsx/Default.html | 136 +-- doc/Axlsx/Drawing.html | 734 +++++------- doc/Axlsx/Fill.html | 81 +- doc/Axlsx/Font.html | 364 +++--- doc/Axlsx/GradientFill.html | 212 ++-- doc/Axlsx/GradientStop.html | 86 +- doc/Axlsx/GraphicFrame.html | 236 ++-- doc/Axlsx/Line3DChart.html | 242 ++-- doc/Axlsx/LineSeries.html | 125 +- doc/Axlsx/Marker.html | 195 ++-- doc/Axlsx/NumFmt.html | 185 ++- doc/Axlsx/OneCellAnchor.html | 354 +++--- doc/Axlsx/Override.html | 152 +-- doc/Axlsx/Package.html | 949 +++------------ doc/Axlsx/PatternFill.html | 177 ++- doc/Axlsx/Pic.html | 856 +++++++------- doc/Axlsx/Pie3DChart.html | 75 +- doc/Axlsx/PieSeries.html | 148 ++- doc/Axlsx/RegexValidator.html | 35 +- doc/Axlsx/Relationship.html | 115 +- doc/Axlsx/Relationships.html | 69 +- doc/Axlsx/RestrictionValidator.html | 55 +- doc/Axlsx/Row.html | 293 +++-- doc/Axlsx/Scaling.html | 161 ++- doc/Axlsx/SerAxis.html | 140 +-- doc/Axlsx/Series.html | 326 ++---- doc/Axlsx/SeriesTitle.html | 57 +- doc/Axlsx/SimpleTypedList.html | 1686 --------------------------- doc/Axlsx/Styles.html | 641 +++++----- doc/Axlsx/TableStyle.html | 149 +-- doc/Axlsx/TableStyleElement.html | 188 ++- doc/Axlsx/TableStyles.html | 141 +-- doc/Axlsx/Title.html | 213 +--- doc/Axlsx/TwoCellAnchor.html | 369 +++--- doc/Axlsx/ValAxis.html | 92 +- doc/Axlsx/ValAxisData.html | 68 +- doc/Axlsx/View3D.html | 215 ++-- doc/Axlsx/Workbook.html | 721 ++++++------ doc/Axlsx/Worksheet.html | 1287 ++++++++------------ doc/Axlsx/Xf.html | 637 +++++----- doc/_index.html | 18 +- doc/class_list.html | 2 +- doc/file.LICENSE.html | 86 ++ doc/file.README.html | 212 ++-- doc/file_list.html | 3 + doc/frames.html | 2 +- doc/index.html | 212 ++-- doc/method_list.html | 1028 +++++++--------- doc/top-level-namespace.html | 6 +- examples/example.rb | 16 +- lib/axlsx.rb | 35 +- lib/axlsx/content_type/default.rb | 11 +- lib/axlsx/content_type/override.rb | 15 +- lib/axlsx/doc_props/app.rb | 76 +- lib/axlsx/drawing/axis.rb | 21 +- lib/axlsx/drawing/bar_3D_chart.rb | 22 +- lib/axlsx/drawing/bar_series.rb | 12 +- lib/axlsx/drawing/cat_axis.rb | 13 +- lib/axlsx/drawing/chart.rb | 36 +- lib/axlsx/drawing/drawing.rb | 46 +- lib/axlsx/drawing/graphic_frame.rb | 6 +- lib/axlsx/drawing/line_3D_chart.rb | 7 +- lib/axlsx/drawing/line_series.rb | 11 +- lib/axlsx/drawing/marker.rb | 14 +- lib/axlsx/drawing/one_cell_anchor.rb | 14 +- lib/axlsx/drawing/pic.rb | 66 +- lib/axlsx/drawing/pie_series.rb | 12 +- lib/axlsx/drawing/scaling.rb | 16 +- lib/axlsx/drawing/ser_axis.rb | 8 +- lib/axlsx/drawing/series.rb | 22 +- lib/axlsx/drawing/series_title.rb | 2 +- lib/axlsx/drawing/title.rb | 17 +- lib/axlsx/drawing/two_cell_anchor.rb | 5 +- lib/axlsx/drawing/val_axis.rb | 4 +- lib/axlsx/drawing/view_3D.rb | 25 +- lib/axlsx/package.rb | 52 +- lib/axlsx/rels/relationship.rb | 6 +- lib/axlsx/stylesheet/border.rb | 13 +- lib/axlsx/stylesheet/border_pr.rb | 11 +- lib/axlsx/stylesheet/cell_alignment.rb | 27 +- lib/axlsx/stylesheet/cell_protection.rb | 7 +- lib/axlsx/stylesheet/cell_style.rb | 19 +- lib/axlsx/stylesheet/color.rb | 14 +- lib/axlsx/stylesheet/fill.rb | 3 +- lib/axlsx/stylesheet/font.rb | 37 +- lib/axlsx/stylesheet/gradient_fill.rb | 26 +- lib/axlsx/stylesheet/gradient_stop.rb | 8 +- lib/axlsx/stylesheet/num_fmt.rb | 6 +- lib/axlsx/stylesheet/pattern_fill.rb | 10 +- lib/axlsx/stylesheet/styles.rb | 24 +- lib/axlsx/stylesheet/table_style.rb | 9 +- lib/axlsx/stylesheet/table_style_element.rb | 13 +- lib/axlsx/stylesheet/table_styles.rb | 8 +- lib/axlsx/stylesheet/xf.rb | 83 +- lib/axlsx/util/validators.rb | 6 +- lib/axlsx/version.rb | 2 +- lib/axlsx/workbook/workbook.rb | 17 +- lib/axlsx/workbook/worksheet/cell.rb | 41 +- lib/axlsx/workbook/worksheet/row.rb | 6 +- lib/axlsx/workbook/worksheet/worksheet.rb | 55 +- test/drawing/tc_one_cell_anchor.rb | 2 +- 128 files changed, 8401 insertions(+), 12928 deletions(-) delete mode 100644 .yardops create mode 100644 .yardopts delete mode 100644 doc/Axlsx/SimpleTypedList.html create mode 100644 doc/file.LICENSE.html diff --git a/.yardoc/checksums b/.yardoc/checksums index 2b34c131..7617f1c1 100644 --- a/.yardoc/checksums +++ b/.yardoc/checksums @@ -1,58 +1,58 @@ -lib/axlsx/stylesheet/table_styles.rb 04b778652c29d612f63e93080d06c3936e48d765 -lib/axlsx/stylesheet/table_style.rb b592135b8b02969a29bd24c28a13282f6af76f30 -lib/axlsx/drawing/pie_3D_chart.rb f9c70bd12b697dcd51780f29c037d4659b48e479 -lib/axlsx/stylesheet/border_pr.rb 09dcb61ec7b0cf49f2da4c4f8ccba8f7e0df7b07 -lib/axlsx/stylesheet/color.rb 4927aaebe27dda42d78bb7baf9a44edc1753c77f +lib/axlsx.rb 3d1e5303c404a2c20dc007eae7f14fb59a0d3aae +lib/axlsx/version.rb 921bd286d3b4f56047b9f51f11d1aa16c0bf930a +lib/axlsx/package.rb d55d5445428d99d77b62d7c742f1c284a0ec4efd +lib/axlsx/drawing/pic.rb d91e014f8e2604480437a434f714ad25d31acbff +lib/axlsx/drawing/axis.rb 8eaf645e24c1fef43a475ceb28caf5116af25736 +lib/axlsx/doc_props/app.rb c64077808d7cb6aa30472e15c600009a01f3f338 +lib/axlsx/drawing/title.rb 497e6ddeb153bb230f5bf9dc76e799b91ae2a8ed +lib/axlsx/drawing/chart.rb bd437e8cb970bbd6df7488b2187199a1f0f3e376 +lib/axlsx/stylesheet/xf.rb 97e3c67007a182fc7df22e5c06f1510cfe5c11ac +lib/axlsx/doc_props/core.rb 90ebc8086f6606af02275c27068c359a5647faf0 +lib/axlsx/drawing/series.rb 168dbadedd446ff0f28bc9a5187b571d07a8936e +lib/axlsx/drawing/marker.rb 8b8c5ef799c7f56288e2951058a93db020846ea9 lib/axlsx/util/constants.rb 4dc8b1d765aa0593615a14c3761b0183be308908 -lib/axlsx/drawing/marker.rb 3507738522c02a3733a01f115d9ef22fae4ea542 -lib/axlsx/stylesheet/cell_protection.rb ce494f9add6de0a51407ddd9122fffe95759a48a -lib/axlsx/stylesheet/cell_style.rb 46c6ff183bce5c6b1ab6228823257d638007b03c -lib/axlsx/drawing/series_title.rb 8f088942649b5b5cc351b621bf8fb252f33cb510 -lib/axlsx/drawing/line_series.rb ffcd6d010ea0606f54a543eb1fc61022aac129d7 -lib/axlsx/drawing/series.rb 1cf010706e32e7e51affbc9edb9d4862a26b33ef -lib/axlsx/package.rb 339a8e5650f45623b126efddd22d3a5f0655aad9 -lib/axlsx/stylesheet/cell_alignment.rb f67f6a0bc16bf13669ed7b18714e4de23825ed94 -lib/axlsx/content_type/default.rb 8ec0d9d1e6bf261735739823acd460c271e3f5ed -lib/axlsx/drawing/title.rb b46fb082e3bea936d129c8aa0998f3b71c9838cc -lib/axlsx/drawing/axis.rb 5e37bac9f4dd258265213d5621522eed3c614954 -lib/axlsx/stylesheet/table_style_element.rb bee66d743e3113fb14adc7ebdecbeb606bfb49fc -lib/axlsx/content_type/content_type.rb 6c576e1618f99f7163fffa6b6e89e964653dcb5f +lib/axlsx/stylesheet/font.rb 1ee29414f720d26b7d484a90d8ebdaa7ecda4fa6 +lib/axlsx/drawing/view_3D.rb 8a83aed740c05d28aaa0e3430c7c4d2bbc44cc61 +lib/axlsx/drawing/drawing.rb 69b5fe2e76d64958e6c6529cabf6d2f717b0df81 +lib/axlsx/stylesheet/fill.rb 44c473c7eafc37690cae9de2cc11543c992752ff +lib/axlsx/util/validators.rb c70f27b943d3711fbe1244a8311789a6fad7e31e +lib/axlsx/drawing/scaling.rb 75a7a015a715bdd25f615ecdbe084d841fdc6ad0 +lib/axlsx/drawing/cat_axis.rb fde414377386d8ee7d1574e96d77a28a991ea21c +lib/axlsx/stylesheet/color.rb 442c205c92723c7b06f10e434ac03e2d09ab559f +lib/axlsx/drawing/ser_axis.rb 1f4952403738e3089e30deb266b1385679d46096 +lib/axlsx/drawing/val_axis.rb 8c1f847cff0b0c788c11b31ac55995566bef16b1 +lib/axlsx/stylesheet/border.rb cee9b6982c4a946f7caa850090f72d0d7ce0a0d2 +lib/axlsx/workbook/workbook.rb 96b55e7154132baf7dac707af3eea09583ef4d95 +lib/axlsx/stylesheet/styles.rb c5685e442e2a61f665e4aab479705bbc1889caed +lib/axlsx/rels/relationship.rb 8d279056b53ba22ff288187ff0f3d18273dcdcb7 +lib/axlsx/stylesheet/num_fmt.rb 796ee45611b89e8a670dcff3dd97ad9306f18048 +lib/axlsx/drawing/bar_series.rb ffe5dae5292d0324442b870fb1958847da6dde5e lib/axlsx/rels/relationships.rb 9c741e180796259bb378a789fd484fa1d8f04425 -lib/axlsx/stylesheet/num_fmt.rb dc830c6540465afa824881efa2f1ce4070957c47 -lib/axlsx.rb 7d8c589a0bdc16acf8774ae1b77d5177b030a80c -lib/axlsx/content_type/override.rb 72245683bca868f181d709a515f9152485653229 -lib/axlsx/drawing/graphic_frame.rb 9fb4e59405ea7974e9759906efd5c8c90dfa9b89 -lib/axlsx/drawing/pie_series.rb df339ed3eeb5692077e3a134339d04e77c9bc89b -lib/axlsx/drawing/bar_series.rb 76d41efe347318587a932f9313f03e0a76abb4ee -lib/axlsx/stylesheet/gradient_fill.rb 5fd260ec2b94ab75a970159035528548a9d21cd6 -lib/axlsx/workbook/worksheet/row.rb f866a98341ce4e604908e42d00f2af09e58c75d2 -lib/axlsx/util/simple_typed_list.rb b95f7e8d8958361cb1946b8545126b9384ff9fd2 -lib/axlsx/workbook/workbook.rb 12c82a584a9bfc4dfbb92c04426413d7eb44a504 -lib/axlsx/stylesheet/fill.rb 35966285f5d759d63451005ceae3a5ae5ba2ceca -lib/axlsx/drawing/view_3D.rb c8e25d57901dd7d679fe7d1ed674d5549ab6f1b3 -lib/axlsx/stylesheet/xf.rb e3d6e2e4c3b0b33c91de4c3db16c73aca3db4473 -lib/axlsx/drawing/two_cell_anchor.rb b89873e55820f9be35f8e5ebe22bd8a0d319622a -lib/axlsx/stylesheet/styles.rb 3679a8fe86270bdef96f02bcf76f2eac27b1c2ef -lib/axlsx/drawing/val_axis.rb da067622f8b09e6caf5067955b277d75ab3c8943 -lib/axlsx/drawing/cat_axis.rb f046262d1e8d04ff697fe29b88725225cd406cb2 -lib/axlsx/util/validators.rb 11eb309df0232fc1ad36c8c5ab0804d656b2294a -lib/axlsx/stylesheet/font.rb 8b002d5fcba2fb0979858517f5254aadf96c7e58 -lib/axlsx/doc_props/app.rb 52f01e985a33253987177798d4e79ed208649b30 -lib/axlsx/workbook/worksheet/worksheet.rb c7159356776e5ca1cfb6d0bc288c3acf278226c8 -lib/axlsx/workbook/worksheet/cell.rb b64976226d09066328cd1ae09763e324c4efada5 -lib/axlsx/rels/relationship.rb 067b924c964a870124d51ea6e39dc1cd8983db21 -lib/axlsx/stylesheet/border.rb 517bfcb43380919ce7abef494d5d3e50911b7c19 -lib/axlsx/drawing/ser_axis.rb 6d15f6cc2092ef5c3baa314ed1af793247418d9b -lib/axlsx/drawing/drawing.rb 243992f4dd131092c6981b3b8cb68905c55d7e1e -lib/axlsx/drawing/chart.rb b0bfdd0cc2f0f48ed3ddcf2a1b1c46c5d9cabc2e -lib/axlsx/version.rb ff68edc0a9bdaaaa00a81a27a3de4fa8fe4e70ce -lib/axlsx/stylesheet/gradient_stop.rb de34e289aeccb4abd9a3b7e60e816a0b12ffacff -lib/axlsx/drawing/cat_axis_data.rb f440010084afad99d97d31354f5b5a8ee8766e9b +lib/axlsx/drawing/pie_series.rb 66dfb2152f3b0e80b358c7af9061beb3c4ab984d +lib/axlsx/drawing/line_series.rb c7475484fd05284520a35806ff4562d125b2b3b8 +lib/axlsx/drawing/bar_3D_chart.rb 83de47e0e9a0c7b46bdc0ea255b50f9ee8a1d1a8 +lib/axlsx/stylesheet/border_pr.rb e8094ee1f75f5028d2ec68dce1590ee68dbede21 +lib/axlsx/content_type/default.rb 1c1a700e266964877599e8fdd28adb6771576030 +lib/axlsx/drawing/series_title.rb 2638d611b790db9281108110623fd71e8e79fae0 +lib/axlsx/drawing/pie_3D_chart.rb f9c70bd12b697dcd51780f29c037d4659b48e479 lib/axlsx/drawing/val_axis_data.rb c57c0abf5abb4aca9fba774f20e2f2c04d3020e8 -lib/axlsx/doc_props/core.rb 90ebc8086f6606af02275c27068c359a5647faf0 -lib/axlsx/drawing/pic.rb b728be1f2f927e02c08b55c7a03b8bc6059f8672 -lib/axlsx/drawing/bar_3D_chart.rb e5199cf0a33e416ea5ddf66677031ee08e5c116f -lib/axlsx/drawing/scaling.rb d3b59eed1897dc2b07bb41b2245c6e4b3e274d7e -lib/axlsx/stylesheet/pattern_fill.rb 817cf55beb3db160b2b56edb6c94de1ecf1ecee7 -lib/axlsx/drawing/one_cell_anchor.rb 512f300984cc9b2c4db73afb967b445d2e240ab7 -lib/axlsx/drawing/line_3D_chart.rb de0a2c8a49259e0348fd2c642c08eb4c567bcf1b +lib/axlsx/drawing/graphic_frame.rb 271e897616d85ebc069820c0d6a7dd3a716deff2 +lib/axlsx/drawing/line_3D_chart.rb 77bc8e6efbe42f8928fb6ffd3c2538ff99ec2444 +lib/axlsx/content_type/override.rb 43ff5dbbb01fbe0237a11c3da7fa5d8e1d5b67ef +lib/axlsx/drawing/cat_axis_data.rb f440010084afad99d97d31354f5b5a8ee8766e9b +lib/axlsx/stylesheet/cell_style.rb ceb0552421cb947584c1800c9aad43536fc7715d +lib/axlsx/util/simple_typed_list.rb b95f7e8d8958361cb1946b8545126b9384ff9fd2 +lib/axlsx/workbook/worksheet/row.rb 17cf7a468717fd6e01fddce1f00199307736adb5 +lib/axlsx/stylesheet/table_style.rb 3c3712b3958b6ae8f645971b0eb1fb92dd1dddbf +lib/axlsx/drawing/one_cell_anchor.rb 523ce88a5fd0245d119a6221ef88d629ed20c51e +lib/axlsx/stylesheet/table_styles.rb 805b00e2abd9b5e248590135067b6e43785e7240 +lib/axlsx/workbook/worksheet/cell.rb 33974b3d9807738d33943321d7864d36e1d5bcf8 +lib/axlsx/drawing/two_cell_anchor.rb 18b904330ac186f497a2c8d13e0b0de881340e09 +lib/axlsx/stylesheet/pattern_fill.rb 9ba1cf8983ab9fba89ca9489fd04714eb6a94a2b +lib/axlsx/stylesheet/gradient_stop.rb 56c3c6b030bad35ee6cff7ad3cd9207048dd4e68 +lib/axlsx/stylesheet/gradient_fill.rb 298777d050500c2f1f53294d8c71fce867997b3d +lib/axlsx/stylesheet/cell_alignment.rb 71118e51e1d11ab570fc89b8fbbd639b8023a39c +lib/axlsx/content_type/content_type.rb 6c576e1618f99f7163fffa6b6e89e964653dcb5f +lib/axlsx/stylesheet/cell_protection.rb 483e77c51f96cb52a805668b0ed40f14bf163634 +lib/axlsx/workbook/worksheet/worksheet.rb 0220616ef72c5bd3f7f4b94127c75a117b35b4d1 +lib/axlsx/stylesheet/table_style_element.rb 117b80432ed6191c81a9e07bd467281319d2b830 diff --git a/.yardoc/objects/root.dat b/.yardoc/objects/root.dat index 211638c5..d5d8617e 100644 Binary files a/.yardoc/objects/root.dat and b/.yardoc/objects/root.dat differ diff --git a/.yardoc/proxy_types b/.yardoc/proxy_types index bc38fbb8..3ba36e0a 100644 Binary files a/.yardoc/proxy_types and b/.yardoc/proxy_types differ diff --git a/.yardops b/.yardops deleted file mode 100644 index 20a78eb1..00000000 --- a/.yardops +++ /dev/null @@ -1,4 +0,0 @@ ---protected ---no-private ---title "AXLSX" -LICENSE CHANGELOG.md diff --git a/.yardopts b/.yardopts new file mode 100644 index 00000000..bed21c93 --- /dev/null +++ b/.yardopts @@ -0,0 +1,4 @@ +--protected +--no-private +--title "AXLSX" +--files LICENSE diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c97382e..889a7469 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ CHANGELOG --------- +- **October.23.11**: 1.0.8 release + - Added support for images (jpg, gif, png) in worksheets. + +- **October.23.11**: 1.0.7 released + - Added support for 3D options when creating a new chart. This lets you set the persective, rotation and other 3D attributes when using worksheet.add_chart + - Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions. + - updated rake to include build, genoc and deploy tasks. + - rebuilt documentation. + - moved version constant to its own file + - fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int. + - Review and improve docs + - rebuild of anchor positioning to remove some spagetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart. + - Refactored cat and val axis data to keep series serialization a bit more DRY + ##October.22.11: 1.0.6 release - Bumping version to include docs. Bug in gemspec pointing to incorrect directory. diff --git a/README.md b/README.md index cdee18e2..639ce559 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,20 @@ Axlsx: Office Open XML Spreadsheet Generation **Author**: Randy Morgan **Copyright**: 2011 **License**: MIT License -**Latest Version**: 1.0.8 -**Ruby Version**: 1.8.7 -**Release Date**: November 23nd 2011 +**Latest Version**: 1.0.9 +**Ruby Version**: 1.8.7 - 1.9.3 +**Release Date**: November 26th 2011 Synopsis -------- Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language. -It enables the you to generate 100% valid xlsx files that include customised styling, images, 3D pie, bar and line charts and auto-width columns. Below is a summary of salient features. +With Axlsx you can create worksheets with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine. + +Help Wanted +----------- + +I'd really like to get rid of the depenency on RMagick in this gem. RMagic is being used to calculate the column widths in a worksheet based on the content the user specified. If there happens to be anyone out there with the background and c skills to write an extenstion that can determine the width of a single character rendered with a specific font at a specific font size please give me a shout. Feature List ------------ @@ -147,6 +152,16 @@ Adding an Image end p.serialize("example7.xlsx") +Asian Language Support + + p = Axlsx::Package.new + p.workbook.add_worksheet do |sheet| + sheet.add_row ["日本語"] + sheet.add_row ["华语/華語"] + sheet.add_row ["한국어/조선말"] + end + p.serialize("example8.xlsx") + ###Documentation This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use: @@ -161,26 +176,12 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem, Changelog --------- -- **October.23.11**: 1.0.8 release - - Added support for images (jpg, gif, png) in worksheets. - -- **October.23.11**: 1.0.7 released - - Added support for 3D options when creating a new chart. This lets you set the persective, rotation and other 3D attributes when using worksheet.add_chart - - Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions. - - updated rake to include build, genoc and deploy tasks. - - rebuilt documentation. - - moved version constant to its own file - - fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int. - - Review and improve docs - - rebuild of anchor positioning to remove some spagetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart. - - Refactored cat and val axis data to keep series serialization a bit more DRY +- **October.26.11**: 1.0.9 release + - Updated to support ruby 1.9.3 + - Updated to eliminate all warnings originating in this gem Please see the {file:CHANGELOG.md} document for past release information. -Help Wanted ------------ - -I'd really like to get rid of the depenency on RMagick in this gem. RMagic is being used to calculate the column widths in a worksheet based on the content the user specified. If there happens to be anyone out there with the background and skill set to write an extenstion that can determine the width of a single character rendered with a specific font at a specific size please give me a shout. Copyright --------- diff --git a/Rakefile b/Rakefile index 72ff0eb5..12ec6a52 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ task :build => :gendoc do system "gem build axlsx.gemspec" end -task :gendoc do +task :gendoc do system "yardoc" end diff --git a/axlsx.gemspec b/axlsx.gemspec index 4e865b94..a48f8417 100644 --- a/axlsx.gemspec +++ b/axlsx.gemspec @@ -1,22 +1,36 @@ +require 'rake' require File.expand_path(File.dirname(__FILE__) + '/lib/axlsx/version.rb') Gem::Specification.new do |s| s.name = 'axlsx' - s.rubyforge_project = 'axlsx' s.version = Axlsx::VERSION - s.date = Time.now.strftime('%Y-%m-%d') - s.summary = "Author fully validated xlsx files with custom charts and styles" - s.platform = Gem::Platform::RUBY - s.description = <<-eof - axslx allows you to create Office Open XML Spreadsheet documents. - It supports automated column widths, multiple worksheets, custom styles, cusomizable charts and allows you to validate your xlsx package before serialization. - eof s.author = "Randy Morgan" - s.email = 'digital.ipeseity@gmail.com' + s.email = 'digital.ipseity@gmail.com' s.homepage = 'https://github.com/randym/axlsx' + s.platform = Gem::Platform::RUBY + s.date = Time.now.strftime('%Y-%m-%d') + s.summary = "OOXML (xlsx) with charts, styles, images and autowidth columns." s.has_rdoc = 'axlsx' - s.files = Dir.glob("{doc,lib,test,schema,examples}/**/*") + ['LICENSE','README.md','Rakefile','CHANGELOG.md'] - s.add_runtime_dependency 'nokogiri', '~> 1' + s.description = <<-eof + xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine. + eof + # s.files = Dir.glob("{doc,lib,test,schema,examples}/**/*") + %w{ LICENSE README.md Rakefile CHANGELOG.md } + + s.files = FileList.new('*', 'lib/**/*', 'doc/**/*', 'test/**/*', 'schema/**/*', 'examples/**/*') do |fl| + fl.exclude("*.*~") + fl.exclude(".DS_Store") + fl.exclude(".gitignore") + fl.exclude(".yardops") + fl.exclude(".yardops_guide") + fl.exclude(".git") + fl.exclude(".*") + fl.exclude("todo") + fl.exclude("*.gem") + fl.exclude("*.xlsx") + end + s.add_runtime_dependency 'nokogiri', '~> 1.4' s.add_runtime_dependency 'active_support', '~> 3' - s.add_runtime_dependency 'rmagick', '~> 2.12' - s.add_runtime_dependency 'rubyzip', '~> 0.9.4' + s.add_runtime_dependency 'rmagick', '~> 2' + s.add_runtime_dependency 'zip', '~> 2' + s.require_path = 'lib' + s.required_ruby_version = '>= 1.8.7' end diff --git a/doc/Axlsx.html b/doc/Axlsx.html index 309542c2..05fbc258 100644 --- a/doc/Axlsx.html +++ b/doc/Axlsx.html @@ -6,7 +6,7 @@ Module: Axlsx - — Documentation by YARD 0.7.3 + — AXLSX @@ -72,8 +72,8 @@
Defined in:
-
lib/axlsx/package.rb,
- lib/axlsx.rb,
lib/axlsx/version.rb,
lib/axlsx/drawing/pic.rb,
lib/axlsx/drawing/axis.rb,
lib/axlsx/doc_props/app.rb,
lib/axlsx/drawing/title.rb,
lib/axlsx/drawing/chart.rb,
lib/axlsx/stylesheet/xf.rb,
lib/axlsx/doc_props/core.rb,
lib/axlsx/drawing/series.rb,
lib/axlsx/drawing/marker.rb,
lib/axlsx/util/constants.rb,
lib/axlsx/stylesheet/font.rb,
lib/axlsx/drawing/view_3D.rb,
lib/axlsx/drawing/drawing.rb,
lib/axlsx/stylesheet/fill.rb,
lib/axlsx/util/validators.rb,
lib/axlsx/drawing/scaling.rb,
lib/axlsx/drawing/cat_axis.rb,
lib/axlsx/stylesheet/color.rb,
lib/axlsx/drawing/ser_axis.rb,
lib/axlsx/drawing/val_axis.rb,
lib/axlsx/stylesheet/border.rb,
lib/axlsx/workbook/workbook.rb,
lib/axlsx/stylesheet/styles.rb,
lib/axlsx/rels/relationship.rb,
lib/axlsx/stylesheet/num_fmt.rb,
lib/axlsx/drawing/bar_series.rb,
lib/axlsx/rels/relationships.rb,
lib/axlsx/drawing/pie_series.rb,
lib/axlsx/drawing/line_series.rb,
lib/axlsx/drawing/bar_3D_chart.rb,
lib/axlsx/stylesheet/border_pr.rb,
lib/axlsx/content_type/default.rb,
lib/axlsx/drawing/series_title.rb,
lib/axlsx/drawing/pie_3D_chart.rb,
lib/axlsx/drawing/val_axis_data.rb,
lib/axlsx/drawing/graphic_frame.rb,
lib/axlsx/drawing/line_3D_chart.rb,
lib/axlsx/content_type/override.rb,
lib/axlsx/drawing/cat_axis_data.rb,
lib/axlsx/stylesheet/cell_style.rb,
lib/axlsx/util/simple_typed_list.rb,
lib/axlsx/workbook/worksheet/row.rb,
lib/axlsx/stylesheet/table_style.rb,
lib/axlsx/drawing/one_cell_anchor.rb,
lib/axlsx/stylesheet/table_styles.rb,
lib/axlsx/workbook/worksheet/cell.rb,
lib/axlsx/drawing/two_cell_anchor.rb,
lib/axlsx/stylesheet/pattern_fill.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
+
lib/axlsx.rb,
+ lib/axlsx/version.rb,
lib/axlsx/package.rb,
lib/axlsx/drawing/pic.rb,
lib/axlsx/drawing/axis.rb,
lib/axlsx/doc_props/app.rb,
lib/axlsx/drawing/title.rb,
lib/axlsx/drawing/chart.rb,
lib/axlsx/stylesheet/xf.rb,
lib/axlsx/doc_props/core.rb,
lib/axlsx/drawing/series.rb,
lib/axlsx/drawing/marker.rb,
lib/axlsx/util/constants.rb,
lib/axlsx/stylesheet/font.rb,
lib/axlsx/drawing/view_3D.rb,
lib/axlsx/drawing/drawing.rb,
lib/axlsx/stylesheet/fill.rb,
lib/axlsx/util/validators.rb,
lib/axlsx/drawing/scaling.rb,
lib/axlsx/drawing/cat_axis.rb,
lib/axlsx/stylesheet/color.rb,
lib/axlsx/drawing/ser_axis.rb,
lib/axlsx/drawing/val_axis.rb,
lib/axlsx/stylesheet/border.rb,
lib/axlsx/workbook/workbook.rb,
lib/axlsx/stylesheet/styles.rb,
lib/axlsx/rels/relationship.rb,
lib/axlsx/stylesheet/num_fmt.rb,
lib/axlsx/drawing/bar_series.rb,
lib/axlsx/rels/relationships.rb,
lib/axlsx/drawing/pie_series.rb,
lib/axlsx/drawing/line_series.rb,
lib/axlsx/drawing/bar_3D_chart.rb,
lib/axlsx/stylesheet/border_pr.rb,
lib/axlsx/content_type/default.rb,
lib/axlsx/drawing/series_title.rb,
lib/axlsx/drawing/pie_3D_chart.rb,
lib/axlsx/drawing/val_axis_data.rb,
lib/axlsx/drawing/graphic_frame.rb,
lib/axlsx/drawing/line_3D_chart.rb,
lib/axlsx/content_type/override.rb,
lib/axlsx/drawing/cat_axis_data.rb,
lib/axlsx/stylesheet/cell_style.rb,
lib/axlsx/util/simple_typed_list.rb,
lib/axlsx/workbook/worksheet/row.rb,
lib/axlsx/stylesheet/table_style.rb,
lib/axlsx/drawing/one_cell_anchor.rb,
lib/axlsx/stylesheet/table_styles.rb,
lib/axlsx/workbook/worksheet/cell.rb,
lib/axlsx/drawing/two_cell_anchor.rb,
lib/axlsx/stylesheet/pattern_fill.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
@@ -81,10 +81,14 @@

Overview

-

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

+ +

xlsx generation with charts, images, automated column width, customizable +styles and full schema validation. Axlsx excels at helping you generate +beautiful Office Open XML Spreadsheet documents without having to +understand the entire ECMA specification. Check out the README for some +examples of how easy it is. Best of all, you can validate your xlsx file +before serialization so you know for sure that anything generated is going +to load on your client's machine.

@@ -98,7 +102,7 @@ cell styles, automatically resized column widths and 3D pie charts. - Classes: App, Axis, Bar3DChart, BarSeries, Border, BorderPr, CatAxis, CatAxisData, Cell, CellAlignment, CellProtection, CellStyle, Chart, Color, ContentType, Core, DataTypeValidator, Default, Drawing, Fill, Font, GradientFill, GradientStop, GraphicFrame, Line3DChart, LineSeries, Marker, NumFmt, OneCellAnchor, Override, Package, PatternFill, Pic, Pie3DChart, PieSeries, RegexValidator, Relationship, Relationships, RestrictionValidator, Row, Scaling, SerAxis, Series, SeriesTitle, SimpleTypedList, Styles, TableStyle, TableStyleElement, TableStyles, Title, TwoCellAnchor, ValAxis, ValAxisData, View3D, Workbook, Worksheet, Xf + Classes: App, Axis, Bar3DChart, BarSeries, Border, BorderPr, CatAxis, CatAxisData, Cell, CellAlignment, CellProtection, CellStyle, Chart, Color, ContentType, Core, DataTypeValidator, Default, Drawing, Fill, Font, GradientFill, GradientStop, GraphicFrame, Line3DChart, LineSeries, Marker, NumFmt, OneCellAnchor, Override, Package, PatternFill, Pic, Pie3DChart, PieSeries, RegexValidator, Relationship, Relationships, RestrictionValidator, Row, Scaling, SerAxis, Series, SeriesTitle, Styles, TableStyle, TableStyleElement, TableStyles, Title, TwoCellAnchor, ValAxis, ValAxisData, View3D, Workbook, Worksheet, Xf

@@ -110,9 +114,8 @@ cell styles, automatically resized column widths and 3D pie charts.
VERSION =
-

-version -

+ +

version

@@ -122,15 +125,13 @@ version
-
"1.0.8"
-
+
"1.0.9"
ENCODING =
-

-XML Encoding -

+ +

XML Encoding

@@ -140,15 +141,13 @@ XML Encoding
-
"UTF-8"
-
+
"UTF-8"
XML_NS =
-

-spreadsheetML namespace -

+ +

spreadsheetML namespace

@@ -158,15 +157,13 @@ spreadsheetML namespace
-
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
-
+
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
XML_NS_T =
-

-content-types namespace -

+ +

content-types namespace

@@ -176,15 +173,13 @@ content-types namespace
-
"http://schemas.openxmlformats.org/package/2006/content-types"
-
+
"http://schemas.openxmlformats.org/package/2006/content-types"
APP_NS =
-

-extended-properties namespace -

+ +

extended-properties namespace

@@ -194,15 +189,13 @@ extended-properties namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
APP_NS_VT =
-

-doc props namespace -

+ +

doc props namespace

@@ -212,15 +205,13 @@ doc props namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
CORE_NS =
-

-core properties namespace -

+ +

core properties namespace

@@ -230,15 +221,13 @@ core properties namespace
-
"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
-
+
"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
CORE_NS_DC =
-

-dc elements (core) namespace -

+ +

dc elements (core) namespace

@@ -248,15 +237,13 @@ dc elements (core) namespace
-
"http://purl.org/dc/elements/1.1/"
-
+
"http://purl.org/dc/elements/1.1/"
CORE_NS_DCMIT =
-

-dcmit (core) namespcace -

+ +

dcmit (core) namespcace

@@ -266,15 +253,13 @@ dcmit (core) namespcace
-
"http://purl.org/dc/dcmitype/"
-
+
"http://purl.org/dc/dcmitype/"
CORE_NS_DCT =
-

-dc terms namespace -

+ +

dc terms namespace

@@ -284,15 +269,13 @@ dc terms namespace
-
"http://purl.org/dc/terms/"
-
+
"http://purl.org/dc/terms/"
CORE_NS_XSI =
-

-xml schema namespace -

+ +

xml schema namespace

@@ -302,15 +285,13 @@ xml schema namespace
-
"http://www.w3.org/2001/XMLSchema-instance"
-
+
"http://www.w3.org/2001/XMLSchema-instance"
XML_NS_XDR =
-

-spreadsheet drawing namespace -

+ +

spreadsheet drawing namespace

@@ -320,15 +301,13 @@ spreadsheet drawing namespace
-
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
-
+
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
XML_NS_A =
-

-drawing namespace -

+ +

drawing namespace

@@ -338,15 +317,13 @@ drawing namespace
-
"http://schemas.openxmlformats.org/drawingml/2006/main"
-
+
"http://schemas.openxmlformats.org/drawingml/2006/main"
XML_NS_C =
-

-chart namespace -

+ +

chart namespace

@@ -356,15 +333,13 @@ chart namespace
-
"http://schemas.openxmlformats.org/drawingml/2006/chart"
-
+
"http://schemas.openxmlformats.org/drawingml/2006/chart"
XML_NS_R =
-

-relationships namespace -

+ +

relationships namespace

@@ -374,15 +349,13 @@ relationships namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
RELS_R =
-

-relationships name space -

+ +

relationships name space

@@ -392,15 +365,13 @@ relationships name space
-
"http://schemas.openxmlformats.org/package/2006/relationships"
-
+
"http://schemas.openxmlformats.org/package/2006/relationships"
TABLE_R =
-

-table rels namespace -

+ +

table rels namespace

@@ -410,15 +381,13 @@ table rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
WORKBOOK_R =
-

-workbook rels namespace -

+ +

workbook rels namespace

@@ -428,15 +397,13 @@ workbook rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
WORKSHEET_R =
-

-worksheet rels namespace -

+ +

worksheet rels namespace

@@ -446,15 +413,13 @@ worksheet rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
APP_R =
-

-app rels namespace -

+ +

app rels namespace

@@ -464,15 +429,13 @@ app rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
CORE_R =
-

-core rels namespace -

+ +

core rels namespace

@@ -482,15 +445,13 @@ core rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata/core-properties"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata/core-properties"
STYLES_R =
-

-styles rels namespace -

+ +

styles rels namespace

@@ -500,15 +461,13 @@ styles rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
DRAWING_R =
-

-drawing rels namespace -

+ +

drawing rels namespace

@@ -518,15 +477,13 @@ drawing rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
CHART_R =
-

-chart rels namespace -

+ +

chart rels namespace

@@ -536,15 +493,13 @@ chart rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
IMAGE_R =
-

-image rels namespace -

+ +

image rels namespace

@@ -554,15 +509,13 @@ image rels namespace
-
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
-
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
TABLE_CT =
-

-table content type -

+ +

table content type

@@ -572,15 +525,13 @@ table content type
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
-
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
WORKBOOK_CT =
-

-workbook content type -

+ +

workbook content type

@@ -590,15 +541,13 @@ workbook content type
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
-
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
APP_CT =
-

-app content type -

+ +

app content type

@@ -608,15 +557,13 @@ app content type
-
"application/vnd.openxmlformats-officedocument.extended-properties+xml"
-
+
"application/vnd.openxmlformats-officedocument.extended-properties+xml"
RELS_CT =
-

-rels content type -

+ +

rels content type

@@ -626,15 +573,13 @@ rels content type
-
"application/vnd.openxmlformats-package.relationships+xml"
-
+
"application/vnd.openxmlformats-package.relationships+xml"
STYLES_CT =
-

-styles content type -

+ +

styles content type

@@ -644,15 +589,13 @@ styles content type
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
-
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
XML_CT =
-

-xml content type -

+ +

xml content type

@@ -662,15 +605,13 @@ xml content type
-
"application/xml"
-
+
"application/xml"
WORKSHEET_CT =
-

-worksheet content type -

+ +

worksheet content type

@@ -680,15 +621,13 @@ worksheet content type
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
-
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
SHARED_STRINGS_CT =
-

-shared strings content type -

+ +

shared strings content type

@@ -698,15 +637,13 @@ shared strings content type
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
-
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
CORE_CT =
-

-core content type -

+ +

core content type

@@ -716,15 +653,13 @@ core content type
-
"application/vnd.openxmlformats-package.core-properties+xml"
-
+
"application/vnd.openxmlformats-package.core-properties+xml"
CHART_CT =
-

-chart content type -

+ +

chart content type

@@ -734,15 +669,13 @@ chart content type
-
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
-
+
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
JPEG_CT =
-

-jpeg content type -

+ +

jpeg content type

@@ -752,15 +685,13 @@ jpeg content type
-
"image/jpeg"
-
+
"image/jpeg"
GIF_CT =
-

-gif content type -

+ +

gif content type

@@ -770,15 +701,13 @@ gif content type
-
"image/gif"
-
+
"image/gif"
PNG_CT =
-

-png content type -

+ +

png content type

@@ -788,15 +717,13 @@ png content type
-
"image/png"
-
+
"image/png"
DRAWING_CT =
-

-drawing content type -

+ +

drawing content type

@@ -806,15 +733,13 @@ drawing content type
-
"application/vnd.openxmlformats-officedocument.drawing+xml"
-
+
"application/vnd.openxmlformats-officedocument.drawing+xml"
XML_EX =
-

-xml content type extensions -

+ +

xml content type extensions

@@ -824,15 +749,13 @@ xml content type extensions
-
"xml"
-
+
"xml"
JPEG_EX =
-

-jpeg extension -

+ +

jpeg extension

@@ -842,15 +765,13 @@ jpeg extension
-
"jpeg"
-
+
"jpeg"
GIF_EX =
-

-gif extension -

+ +

gif extension

@@ -860,15 +781,13 @@ gif extension
-
"gif"
-
+
"gif"
PNG_EX =
-

-png extension -

+ +

png extension

@@ -878,15 +797,13 @@ png extension
-
"png"
-
+
"png"
RELS_EX =
-

-rels content type extension -

+ +

rels content type extension

@@ -896,15 +813,13 @@ rels content type extension
-
"rels"
-
+
"rels"
WORKBOOK_PN =
-

-workbook part -

+ +

workbook part

@@ -914,15 +829,13 @@ workbook part
-
"xl/workbook.xml"
-
+
"xl/workbook.xml"
STYLES_PN =
-

-styles part -

+ +

styles part

@@ -932,15 +845,13 @@ styles part
-
"styles.xml"
-
+
"styles.xml"
APP_PN =
-

-app part -

+ +

app part

@@ -950,15 +861,13 @@ app part
-
"docProps/app.xml"
-
+
"docProps/app.xml"
CORE_PN =
-

-core part -

+ +

core part

@@ -968,15 +877,13 @@ core part
-
"docProps/core.xml"
-
+
"docProps/core.xml"
CONTENT_TYPES_PN =
-

-content types part -

+ +

content types part

@@ -986,15 +893,13 @@ content types part
-
"[Content_Types].xml"
-
+
"[Content_Types].xml"
RELS_PN =
-

-rels part -

+ +

rels part

@@ -1004,15 +909,13 @@ rels part
-
"_rels/.rels"
-
+
"_rels/.rels"
WORKBOOK_RELS_PN =
-

-workbook rels part -

+ +

workbook rels part

@@ -1022,15 +925,13 @@ workbook rels part
-
"xl/_rels/workbook.xml.rels"
-
+
"xl/_rels/workbook.xml.rels"
WORKSHEET_PN =
-

-worksheet part -

+ +

worksheet part

@@ -1040,15 +941,13 @@ worksheet part
-
"worksheets/sheet%d.xml"
-
+
"worksheets/sheet%d.xml"
WORKSHEET_RELS_PN =
-

-worksheet rels part -

+ +

worksheet rels part

@@ -1058,15 +957,13 @@ worksheet rels part
-
"worksheets/_rels/sheet%d.xml.rels"
-
+
"worksheets/_rels/sheet%d.xml.rels"
DRAWING_PN =
-

-drawing part -

+ +

drawing part

@@ -1076,15 +973,13 @@ drawing part
-
"drawings/drawing%d.xml"
-
+
"drawings/drawing%d.xml"
DRAWING_RELS_PN =
-

-drawing rels part -

+ +

drawing rels part

@@ -1094,15 +989,13 @@ drawing rels part
-
"drawings/_rels/drawing%d.xml.rels"
-
+
"drawings/_rels/drawing%d.xml.rels"
CHART_PN =
-

-chart part -

+ +

chart part

@@ -1112,15 +1005,13 @@ chart part
-
"charts/chart%d.xml"
-
+
"charts/chart%d.xml"
IMAGE_PN =
-

-chart part -

+ +

chart part

@@ -1130,15 +1021,13 @@ chart part
-
"media/image%d.%s"
-
+
"media/image%d.%s"
APP_XSD =
-

-App validation schema -

+ +

App validation schema

@@ -1148,15 +1037,13 @@ App validation schema
-
"lib/schema/shared-documentPropertiesExtended.xsd"
-
+
"lib/schema/shared-documentPropertiesExtended.xsd"
CORE_XSD =
-

-core validation schema -

+ +

core validation schema

@@ -1166,15 +1053,13 @@ core validation schema
-
"lib/schema/opc-coreProperties.xsd"
-
+
"lib/schema/opc-coreProperties.xsd"
CONTENT_TYPES_XSD =
-

-content types validation schema -

+ +

content types validation schema

@@ -1184,15 +1069,13 @@ content types validation schema
-
"lib/schema/opc-contentTypes.xsd"
-
+
"lib/schema/opc-contentTypes.xsd"
RELS_XSD =
-

-rels validation schema -

+ +

rels validation schema

@@ -1202,15 +1085,13 @@ rels validation schema
-
"lib/schema/opc-relationships.xsd"
-
+
"lib/schema/opc-relationships.xsd"
SML_XSD =
-

-spreadsheetML validation schema -

+ +

spreadsheetML validation schema

@@ -1220,15 +1101,13 @@ spreadsheetML validation schema
-
"lib/schema/sml.xsd"
-
+
"lib/schema/sml.xsd"
DRAWING_XSD =
-

-drawing validation schema -

+ +

drawing validation schema

@@ -1238,15 +1117,13 @@ drawing validation schema
-
"lib/schema/dml-spreadsheetDrawing.xsd"
-
+
"lib/schema/dml-spreadsheetDrawing.xsd"
NUM_FMT_PERCENT =
-

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

+ +

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

@@ -1256,15 +1133,13 @@ number format id for pecentage formatting using the default formatting id.
-
9
-
+
9
NUM_FMT_YYYYMMDD =
-

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

+ +

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

@@ -1274,15 +1149,13 @@ number format id for date format like 2011/11/13
-
100
-
+
100
NUM_FMT_YYYYMMDDHHMMSS =
-

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

+ +

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

@@ -1292,15 +1165,13 @@ number format id for time format the creates 2011/11/13 12:23:10
-
101
-
+
101
STYLE_THIN_BORDER =
-

-cellXfs id for thin borders around the cell -

+ +

cellXfs id for thin borders around the cell

@@ -1310,15 +1181,13 @@ cellXfs id for thin borders around the cell
-
1
-
+
1
ERR_RESTRICTION =
-

-error messages RestrictionValidor -

+ +

error messages RestrictionValidor

@@ -1328,15 +1197,13 @@ error messages RestrictionValidor
-
"Invalid Data: %s. %s must be one of %s."
-
+
"Invalid Data: %s. %s must be one of %s."
ERR_TYPE =
-

-error message DataTypeValidator -

+ +

error message DataTypeValidator

@@ -1346,15 +1213,13 @@ error message DataTypeValidator
-
"Invalid Data %s for %s. must be %s."
-
+
"Invalid Data %s for %s. must be %s."
ERR_REGEX =
-

-error message for RegexValidator -

+ +

error message for RegexValidator

@@ -1364,8 +1229,7 @@ error message for RegexValidator
-
"Invalid Data. %s does not match %s."
-
+
"Invalid Data. %s does not match %s."
@@ -1398,9 +1262,8 @@ error message for RegexValidator -

-determines the cell range for the items provided. -

+
+

determines the cell range for the items provided.

@@ -1422,10 +1285,9 @@ determines the cell range for the items provided. -

-Requires that the value is a form that can be evaluated as a boolean in an -xml document. -

+
+

Requires that the value is a form that can be evaluated as a boolean in an +xml document.

@@ -1447,11 +1309,10 @@ xml document. -

-Requires that the value is a valid content_type TABLE_CT, WORKBOOK_CT, +

+

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. -

+CORE_CT, CHART_CT, DRAWING_CT are allowed.

@@ -1473,9 +1334,8 @@ CORE_CT, CHART_CT, DRAWING_CT are allowed. -

-Requires that the value is a Float. -

+
+

Requires that the value is a Float.

@@ -1497,9 +1357,8 @@ Requires that the value is a Float. -

-Requires that the value is a gradient_type. -

+
+

Requires that the value is a gradient_type.

@@ -1521,11 +1380,10 @@ Requires that the value is a gradient_type. -

-Requires that the value is a valid horizontal_alignment :general, :left, +

+

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

+allowed.

@@ -1547,9 +1405,8 @@ allowed. -

-Requires that the value is a Fixnum or Integer. -

+
+

Requires that the value is a Fixnum or Integer.

@@ -1571,9 +1428,8 @@ Requires that the value is a Fixnum or Integer. -

-Requires that the value is valid pattern type. -

+
+

Requires that the value is valid pattern type.

@@ -1595,11 +1451,10 @@ Requires that the value is valid pattern type. -

-Requires that the value is a valid relationship_type XML_NS_R, TABLE_R, +

+

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. -

+DRAWING_R are allowed.

@@ -1621,9 +1476,8 @@ DRAWING_R are allowed. -

-Requires that the value is a String. -

+
+

Requires that the value is a String.

@@ -1645,8 +1499,8 @@ Requires that the value is a String. -

-Requires that the value is a valid table element type :wholeTable, +

+

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

+:pageFieldLabels, :pageFieldValues are allowed.

@@ -1677,10 +1530,9 @@ Requires that the value is a valid table element type :wholeTable, -

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

+
+

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

@@ -1702,10 +1554,9 @@ Requires that the value is a Fixnum or Integer and is greater or equal to -

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

+
+

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

@@ -1729,9 +1580,8 @@ Requires that the value is a valid vertical_alignment :top, :center,

-

-determines the cell range for the items provided -

+ +

determines the cell range for the items provided

@@ -1745,21 +1595,24 @@ determines the cell range for the items provided
 
 
-31
-32
-33
-34
-35
+36 +37 +38 +39 +40 +41 +42 -
# 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
-
+
# File 'lib/axlsx.rb', line 36
+
+def self.cell_range(items)
+  return "" unless items.first.is_a? Cell          
+  ref = "#{items.first.row.worksheet.name}!" +
+    "#{items.first.r_abs}"
+  ref += ":#{items.last.r_abs}" if items.size > 1
+  ref
+end
@@ -1774,13 +1627,11 @@ determines the cell range for the items provided

-

-Requires that the value is a form that can be evaluated as a boolean in an + +

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" -

+Symbol, TrueClass or FalseClass and it must be one of 0, 1, "true", +"false", :true, :false, true, false, "0", or "1"

@@ -1799,9 +1650,8 @@ Symbol, TrueClass or FalseClass and it must be one of 0, 1, — -

-The value validated -

+
+

The value validated

@@ -1822,10 +1672,9 @@ The value validated
# 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
-
+def self.validate_boolean(v) + DataTypeValidator.validate(:boolean, [Fixnum, String, Integer, Symbol, TrueClass, FalseClass], v, lambda { |arg| [0, 1, "true", "false", :true, :false, true, false, "0", "1"].include?(arg) }) +end @@ -1840,11 +1689,10 @@ The value validated

-

-Requires that the value is a valid content_type TABLE_CT, WORKBOOK_CT, + +

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 -

+CORE_CT, CHART_CT, DRAWING_CT are allowed

@@ -1863,9 +1711,8 @@ CORE_CT, CHART_CT, DRAWING_CT are allowed — -

-The value validated -

+
+

The value validated

@@ -1886,10 +1733,9 @@ The value validated
# 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, JPEG_CT, GIF_CT, PNG_CT, DRAWING_CT], v
-end
-
+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, JPEG_CT, GIF_CT, PNG_CT, DRAWING_CT], v +end @@ -1904,9 +1750,8 @@ The value validated

-

-Requires that the value is a Float -

+ +

Requires that the value is a Float

@@ -1925,9 +1770,8 @@ Requires that the value is a Float — -

-The value validated -

+
+

The value validated

@@ -1948,10 +1792,9 @@ The value validated
# File 'lib/axlsx/util/validators.rb', line 77
 
-def self.validate_float(v)
-  DataTypeValidator.validate :float, Float, v
-end
-
+def self.validate_float(v) + DataTypeValidator.validate :float, Float, v +end @@ -1966,10 +1809,9 @@ The value validated

-

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

+ +

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

@@ -1988,9 +1830,8 @@ Requires that the value is a gradient_type. valid types are :linear and — -

-The value validated -

+
+

The value validated

@@ -2011,10 +1852,9 @@ The value validated
# File 'lib/axlsx/util/validators.rb', line 93
 
-def self.validate_gradient_type(v)
-  RestrictionValidator.validate :gradient_type, [:linear, :path], v
-end
-
+def self.validate_gradient_type(v) + RestrictionValidator.validate :gradient_type, [:linear, :path], v +end @@ -2029,11 +1869,10 @@ The value validated

-

-Requires that the value is a valid horizontal_alignment :general, :left, + +

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

+allowed

@@ -2052,9 +1891,8 @@ allowed — -

-The value validated -

+
+

The value validated

@@ -2075,10 +1913,9 @@ The value validated
# 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
-
+def self.validate_horizontal_alignment(v) + RestrictionValidator.validate :horizontal_alignment, [:general, :left, :center, :right, :fill, :justify, :centerContinuous, :distributed], v +end @@ -2093,9 +1930,8 @@ The value validated

-

-Requires that the value is a Fixnum or Integer -

+ +

Requires that the value is a Fixnum or Integer

@@ -2114,9 +1950,8 @@ Requires that the value is a Fixnum or Integer — -

-The value validated -

+
+

The value validated

@@ -2137,10 +1972,9 @@ The value validated
# File 'lib/axlsx/util/validators.rb', line 57
 
-def self.validate_int(v)
-  DataTypeValidator.validate :unsigned_int, [Fixnum, Integer], v
-end
-
+def self.validate_int(v) + DataTypeValidator.validate :unsigned_int, [Fixnum, Integer], v +end @@ -2155,13 +1989,12 @@ The value validated

-

-Requires that the value is valid pattern type. valid pattern types must be + +

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. -

+:lightTrellis, :gray125, or :gray0625.

@@ -2180,9 +2013,8 @@ one of :none, :solid, :mediumGray, :darkGray, :lightGray, :darkHorizontal, — -

-The value validated -

+
+

The value validated

@@ -2204,11 +2036,10 @@ The value validated
# 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
-
+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 @@ -2223,11 +2054,10 @@ The value validated

-

-Requires that the value is a valid relationship_type XML_NS_R, TABLE_R, + +

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 -

+DRAWING_R are allowed

@@ -2246,9 +2076,8 @@ DRAWING_R are allowed — -

-The value validated -

+
+

The value validated

@@ -2269,10 +2098,9 @@ The value validated
# 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, IMAGE_R], v
-end
-
+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, IMAGE_R], v +end @@ -2287,9 +2115,8 @@ The value validated

-

-Requires that the value is a String -

+ +

Requires that the value is a String

@@ -2308,9 +2135,8 @@ Requires that the value is a String — -

-The value validated -

+
+

The value validated

@@ -2331,10 +2157,9 @@ The value validated
# File 'lib/axlsx/util/validators.rb', line 71
 
-def self.validate_string(v)
-  DataTypeValidator.validate :string, String, v
-end
-
+def self.validate_string(v) + DataTypeValidator.validate :string, String, v +end @@ -2349,8 +2174,8 @@ The value validated

-

-Requires that the value is a valid table element type :wholeTable, + +

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

+:pageFieldLabels, :pageFieldValues are allowed

@@ -2378,9 +2202,8 @@ Requires that the value is a valid table element type :wholeTable, — -

-The value validated -

+
+

The value validated

@@ -2401,10 +2224,9 @@ The value validated
# 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
-
+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 @@ -2419,9 +2241,8 @@ The value validated

-

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

+ +

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

@@ -2440,9 +2261,8 @@ Requires that the value is a Fixnum or Integer and is greater or equal to 0 — -

-The value validated -

+
+

The value validated

@@ -2460,9 +2280,8 @@ The value validated — -

-true if the data is valid -

+
+

true if the data is valid

@@ -2479,9 +2298,8 @@ true if the data is valid — -

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

+
+

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

@@ -2501,10 +2319,9 @@ raised if the value is not a Fixnum or Integer value greater or equal to 0
# 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
-
+def self.validate_unsigned_int(v) + DataTypeValidator.validate(:unsigned_int, [Fixnum, Integer], v, lambda { |arg| arg.respond_to?(:>=) && arg >= 0 }) +end @@ -2519,10 +2336,9 @@ raised if the value is not a Fixnum or Integer value greater or equal to 0

-

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

+ +

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

@@ -2541,9 +2357,8 @@ Requires that the value is a valid vertical_alignment :top, :center, — -

-The value validated -

+
+

The value validated

@@ -2564,10 +2379,9 @@ The value validated
# 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
-
+def self.validate_vertical_alignment(v) + RestrictionValidator.validate :vertical_alignment, [:top, :center, :bottom, :justify, :distributed], v +end @@ -2578,9 +2392,9 @@ The value validated
diff --git a/doc/Axlsx/App.html b/doc/Axlsx/App.html index c442c69e..ca993af0 100644 --- a/doc/Axlsx/App.html +++ b/doc/Axlsx/App.html @@ -6,7 +6,7 @@ Class: Axlsx::App - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,22 +97,19 @@
Note: -

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

-

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

+
+

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 + +

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. -

+object.

@@ -151,9 +148,8 @@ object. -

-The name of the application. -

+
+

The name of the application.

@@ -178,9 +174,8 @@ The name of the application. -

-The version of the application. -

+
+

The version of the application.

@@ -205,9 +200,8 @@ The version of the application. -

-The number of characters in the document. -

+
+

The number of characters in the document.

@@ -232,9 +226,8 @@ The number of characters in the document. -

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

+
+

The number of characters in the document including spaces.

@@ -259,9 +252,8 @@ The number of characters in the document including spaces. -

-The name of the company generating the document. -

+
+

The name of the company generating the document.

@@ -286,9 +278,8 @@ The name of the company generating the document. -

-Document security. -

+
+

Document security.

@@ -313,9 +304,8 @@ Document security. -

-The number of hidden slides. -

+
+

The number of hidden slides.

@@ -340,9 +330,8 @@ The number of hidden slides. -

-The base for hyper links in the document. -

+
+

The base for hyper links in the document.

@@ -367,9 +356,8 @@ The base for hyper links in the document. -

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

+
+

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

@@ -394,9 +382,8 @@ Indicates that the hyper links in the document have been changed. -

-The number of lines in the document. -

+
+

The number of lines in the document.

@@ -421,9 +408,8 @@ The number of lines in the document. -

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

+
+

The links in the document are up to date.

@@ -448,9 +434,8 @@ The links in the document are up to date. -

-The name of the manager for the document. -

+
+

The name of the manager for the document.

@@ -475,9 +460,8 @@ The name of the manager for the document. -

-The total number multimedia clips. -

+
+

The total number multimedia clips.

@@ -502,9 +486,8 @@ The total number multimedia clips. -

-The number of slides that have notes. -

+
+

The number of slides that have notes.

@@ -529,9 +512,8 @@ The number of slides that have notes. -

-The number of pages in the document. -

+
+

The number of pages in the document.

@@ -556,9 +538,8 @@ The number of pages in the document. -

-The number of paragraphs in the document. -

+
+

The number of paragraphs in the document.

@@ -583,9 +564,8 @@ The number of paragraphs in the document. -

-The intended format of the presentation. -

+
+

The intended format of the presentation.

@@ -610,9 +590,8 @@ The intended format of the presentation. -

-The display mode for the document thumbnail. -

+
+

The display mode for the document thumbnail.

@@ -637,9 +616,8 @@ The display mode for the document thumbnail. -

-Indicates if the document is shared. -

+
+

Indicates if the document is shared.

@@ -664,9 +642,8 @@ Indicates if the document is shared. -

-The number of slides in the document. -

+
+

The number of slides in the document.

@@ -691,9 +668,8 @@ The number of slides in the document. -

-The name of the document template. -

+
+

The name of the document template.

@@ -718,9 +694,8 @@ The name of the document template. -

-The total amount of time spent editing. -

+
+

The total amount of time spent editing.

@@ -745,9 +720,8 @@ The total amount of time spent editing. -

-The number of words in the document. -

+
+

The number of words in the document.

@@ -782,9 +756,8 @@ The number of words in the document. -

-Creates an App object. -

+
+

Creates an App object.

@@ -806,9 +779,8 @@ Creates an App object. -

-Generate an app.xml document. -

+
+

Generate an app.xml document.

@@ -833,9 +805,8 @@ Generate an app.xml document.

-

-The name of the application -

+ +

The name of the application

@@ -853,9 +824,8 @@ The name of the application — -

-The name of the application -

+
+

The name of the application

@@ -875,10 +845,9 @@ The name of the application
# File 'lib/axlsx/doc_props/app.rb', line 74
 
-def Application
-  @Application
-end
-
+def Application + @Application +end @@ -896,9 +865,8 @@ The name of the application

-

-The version of the application. -

+ +

The version of the application.

@@ -916,9 +884,8 @@ The version of the application. — -

-The version of the application. -

+
+

The version of the application.

@@ -938,10 +905,9 @@ The version of the application.
# File 'lib/axlsx/doc_props/app.rb', line 77
 
-def AppVersion
-  @AppVersion
-end
-
+def AppVersion + @AppVersion +end @@ -959,9 +925,8 @@ The version of the application.

-

-The number of characters in the document. -

+ +

The number of characters in the document.

@@ -979,9 +944,8 @@ The number of characters in the document. — -

-The number of characters in the document. -

+
+

The number of characters in the document.

@@ -1001,10 +965,9 @@ The number of characters in the document.
# File 'lib/axlsx/doc_props/app.rb', line 29
 
-def Characters
-  @Characters
-end
-
+def Characters + @Characters +end @@ -1022,9 +985,8 @@ The number of characters in the document.

-

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

+ +

The number of characters in the document including spaces.

@@ -1042,9 +1004,8 @@ The number of characters in the document including spaces. — -

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

+
+

The number of characters in the document including spaces.

@@ -1064,10 +1025,9 @@ The number of characters in the document including spaces.
# File 'lib/axlsx/doc_props/app.rb', line 62
 
-def CharactersWithSpaces
-  @CharactersWithSpaces
-end
-
+def CharactersWithSpaces + @CharactersWithSpaces +end @@ -1085,9 +1045,8 @@ The number of characters in the document including spaces.

-

-The name of the company generating the document. -

+ +

The name of the company generating the document.

@@ -1105,9 +1064,8 @@ The name of the company generating the document. — -

-The name of the company generating the document. -

+
+

The name of the company generating the document.

@@ -1127,10 +1085,9 @@ The name of the company generating the document.
# File 'lib/axlsx/doc_props/app.rb', line 20
 
-def Company
-  @Company
-end
-
+def Company + @Company +end @@ -1148,9 +1105,8 @@ The name of the company generating the document.

-

-Document security -

+ +

Document security

@@ -1168,9 +1124,8 @@ Document security — -

-Document security -

+
+

Document security

@@ -1190,10 +1145,9 @@ Document security
# File 'lib/axlsx/doc_props/app.rb', line 80
 
-def DocSecurity
-  @DocSecurity
-end
-
+def DocSecurity + @DocSecurity +end @@ -1211,9 +1165,8 @@ Document security

-

-The number of hidden slides. -

+ +

The number of hidden slides.

@@ -1231,9 +1184,8 @@ The number of hidden slides. — -

-The number of hidden slides. -

+
+

The number of hidden slides.

@@ -1253,10 +1205,9 @@ The number of hidden slides.
# File 'lib/axlsx/doc_props/app.rb', line 50
 
-def HiddenSlides
-  @HiddenSlides
-end
-
+def HiddenSlides + @HiddenSlides +end @@ -1274,9 +1225,8 @@ The number of hidden slides.

-

-The base for hyper links in the document. -

+ +

The base for hyper links in the document.

@@ -1294,9 +1244,8 @@ The base for hyper links in the document. — -

-The base for hyper links in the document. -

+
+

The base for hyper links in the document.

@@ -1316,10 +1265,9 @@ The base for hyper links in the document.
# File 'lib/axlsx/doc_props/app.rb', line 68
 
-def HyperLinkBase
-  @HyperLinkBase
-end
-
+def HyperLinkBase + @HyperLinkBase +end @@ -1337,9 +1285,8 @@ The base for hyper links in the document.

-

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

+ +

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

@@ -1357,9 +1304,8 @@ Indicates that the hyper links in the document have been changed. — -

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

+
+

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

@@ -1379,10 +1325,9 @@ Indicates that the hyper links in the document have been changed.
# File 'lib/axlsx/doc_props/app.rb', line 71
 
-def HyperlinksChanged
-  @HyperlinksChanged
-end
-
+def HyperlinksChanged + @HyperlinksChanged +end @@ -1400,9 +1345,8 @@ Indicates that the hyper links in the document have been changed.

-

-The number of lines in the document. -

+ +

The number of lines in the document.

@@ -1420,9 +1364,8 @@ The number of lines in the document. — -

-The number of lines in the document. -

+
+

The number of lines in the document.

@@ -1442,10 +1385,9 @@ The number of lines in the document.
# File 'lib/axlsx/doc_props/app.rb', line 35
 
-def Lines
-  @Lines
-end
-
+def Lines + @Lines +end @@ -1463,9 +1405,8 @@ The number of lines in the document.

-

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

+ +

The links in the document are up to date.

@@ -1483,9 +1424,8 @@ The links in the document are up to date. — -

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

+
+

The links in the document are up to date.

@@ -1505,10 +1445,9 @@ The links in the document are up to date.
# File 'lib/axlsx/doc_props/app.rb', line 59
 
-def LinksUpToDate
-  @LinksUpToDate
-end
-
+def LinksUpToDate + @LinksUpToDate +end @@ -1526,9 +1465,8 @@ The links in the document are up to date.

-

-The name of the manager for the document. -

+ +

The name of the manager for the document.

@@ -1546,9 +1484,8 @@ The name of the manager for the document. — -

-The name of the manager for the document. -

+
+

The name of the manager for the document.

@@ -1568,10 +1505,9 @@ The name of the manager for the document.
# File 'lib/axlsx/doc_props/app.rb', line 17
 
-def Manager
-  @Manager
-end
-
+def Manager + @Manager +end @@ -1589,9 +1525,8 @@ The name of the manager for the document.

-

-The total number multimedia clips -

+ +

The total number multimedia clips

@@ -1609,9 +1544,8 @@ The total number multimedia clips — -

-The total number multimedia clips -

+
+

The total number multimedia clips

@@ -1631,10 +1565,9 @@ The total number multimedia clips
# File 'lib/axlsx/doc_props/app.rb', line 53
 
-def MMClips
-  @MMClips
-end
-
+def MMClips + @MMClips +end @@ -1652,9 +1585,8 @@ The total number multimedia clips

-

-The number of slides that have notes. -

+ +

The number of slides that have notes.

@@ -1672,9 +1604,8 @@ The number of slides that have notes. — -

-The number of slides that have notes. -

+
+

The number of slides that have notes.

@@ -1694,10 +1625,9 @@ The number of slides that have notes.
# File 'lib/axlsx/doc_props/app.rb', line 44
 
-def Notes
-  @Notes
-end
-
+def Notes + @Notes +end @@ -1715,9 +1645,8 @@ The number of slides that have notes.

-

-The number of pages in the document. -

+ +

The number of pages in the document.

@@ -1735,9 +1664,8 @@ The number of pages in the document. — -

-The number of pages in the document. -

+
+

The number of pages in the document.

@@ -1757,10 +1685,9 @@ The number of pages in the document.
# File 'lib/axlsx/doc_props/app.rb', line 23
 
-def Pages
-  @Pages
-end
-
+def Pages + @Pages +end @@ -1778,9 +1705,8 @@ The number of pages in the document.

-

-The number of paragraphs in the document -

+ +

The number of paragraphs in the document

@@ -1798,9 +1724,8 @@ The number of paragraphs in the document — -

-The number of paragraphs in the document -

+
+

The number of paragraphs in the document

@@ -1820,10 +1745,9 @@ The number of paragraphs in the document
# File 'lib/axlsx/doc_props/app.rb', line 38
 
-def Paragraphs
-  @Paragraphs
-end
-
+def Paragraphs + @Paragraphs +end @@ -1841,9 +1765,8 @@ The number of paragraphs in the document

-

-The intended format of the presentation. -

+ +

The intended format of the presentation.

@@ -1861,9 +1784,8 @@ The intended format of the presentation. — -

-The intended format of the presentation. -

+
+

The intended format of the presentation.

@@ -1883,10 +1805,9 @@ The intended format of the presentation.
# File 'lib/axlsx/doc_props/app.rb', line 32
 
-def PresentationFormat
-  @PresentationFormat
-end
-
+def PresentationFormat + @PresentationFormat +end @@ -1904,9 +1825,8 @@ The intended format of the presentation.

-

-The display mode for the document thumbnail. -

+ +

The display mode for the document thumbnail.

@@ -1924,9 +1844,8 @@ The display mode for the document thumbnail. — -

-The display mode for the document thumbnail. -

+
+

The display mode for the document thumbnail.

@@ -1946,10 +1865,9 @@ The display mode for the document thumbnail.
# File 'lib/axlsx/doc_props/app.rb', line 56
 
-def ScaleCrop
-  @ScaleCrop
-end
-
+def ScaleCrop + @ScaleCrop +end @@ -1967,9 +1885,8 @@ The display mode for the document thumbnail.

-

-Indicates if the document is shared. -

+ +

Indicates if the document is shared.

@@ -1987,9 +1904,8 @@ Indicates if the document is shared. — -

-Indicates if the document is shared. -

+
+

Indicates if the document is shared.

@@ -2009,10 +1925,9 @@ Indicates if the document is shared.
# File 'lib/axlsx/doc_props/app.rb', line 65
 
-def ShareDoc
-  @ShareDoc
-end
-
+def ShareDoc + @ShareDoc +end @@ -2030,9 +1945,8 @@ Indicates if the document is shared.

-

-The number of slides in the document. -

+ +

The number of slides in the document.

@@ -2050,9 +1964,8 @@ The number of slides in the document. — -

-The number of slides in the document. -

+
+

The number of slides in the document.

@@ -2072,10 +1985,9 @@ The number of slides in the document.
# File 'lib/axlsx/doc_props/app.rb', line 41
 
-def Slides
-  @Slides
-end
-
+def Slides + @Slides +end @@ -2093,9 +2005,8 @@ The number of slides in the document.

-

-The name of the document template. -

+ +

The name of the document template.

@@ -2113,9 +2024,8 @@ The name of the document template. — -

-The name of the document template. -

+
+

The name of the document template.

@@ -2135,10 +2045,9 @@ The name of the document template.
# File 'lib/axlsx/doc_props/app.rb', line 14
 
-def Template
-  @Template
-end
-
+def Template + @Template +end @@ -2156,9 +2065,8 @@ The name of the document template.

-

-The total amount of time spent editing. -

+ +

The total amount of time spent editing.

@@ -2176,9 +2084,8 @@ The total amount of time spent editing. — -

-The total amount of time spent editing. -

+
+

The total amount of time spent editing.

@@ -2198,10 +2105,9 @@ The total amount of time spent editing.
# File 'lib/axlsx/doc_props/app.rb', line 47
 
-def TotalTime
-  @TotalTime
-end
-
+def TotalTime + @TotalTime +end @@ -2219,9 +2125,8 @@ The total amount of time spent editing.

-

-The number of words in the document. -

+ +

The number of words in the document.

@@ -2239,9 +2144,8 @@ The number of words in the document. — -

-The number of words in the document. -

+
+

The number of words in the document.

@@ -2261,10 +2165,9 @@ The number of words in the document.
# File 'lib/axlsx/doc_props/app.rb', line 26
 
-def Words
-  @Words
-end
-
+def Words + @Words +end @@ -2286,9 +2189,8 @@ The number of words in the document.

-

-Creates an App object -

+ +

Creates an App object

@@ -2309,9 +2211,8 @@ Creates an App object — -

-a customizable set of options -

+
+

a customizable set of options

@@ -2541,12 +2442,11 @@ a customizable set of options
# 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
-
+def initalize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] + end +end @@ -2561,9 +2461,8 @@ a customizable set of options

-

-Generate an app.xml document -

+ +

Generate an app.xml document

@@ -2581,9 +2480,8 @@ Generate an app.xml document — -

-The document as a string -

+
+

The document as a string

@@ -2596,31 +2494,30 @@ The document as a string
 
 
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
+167 +168 +169 +170 +171 +172 +173 +174 +175 +176 -
# 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
-
+
# File 'lib/axlsx/doc_props/app.rb', line 167
+
+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
@@ -2631,9 +2528,9 @@ The document as a string
diff --git a/doc/Axlsx/Axis.html b/doc/Axlsx/Axis.html index efc31547..b3e3b295 100644 --- a/doc/Axlsx/Axis.html +++ b/doc/Axlsx/Axis.html @@ -6,7 +6,7 @@ Class: Axlsx::Axis - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

Overview

-

-the access class defines common properties and values for a chart axis. -

+ +

the access class defines common properties and values for a chart axis.

@@ -132,9 +131,8 @@ the access class defines common properties and values for a chart axis. -

-the id of the axis. -

+
+

the id of the axis.

@@ -159,9 +157,8 @@ the id of the axis. -

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

+
+

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

@@ -186,9 +183,8 @@ The position of the axis must be one of [:l, :r, :t, :b]. -

-The perpendicular axis. -

+
+

The perpendicular axis.

@@ -213,10 +209,9 @@ The perpendicular axis. -

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

+
+

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

@@ -241,9 +236,8 @@ specifies how the perpendicular axis is crossed must be one of [:autoZero, -

-The number format format code for this axis default :General. -

+
+

The number format format code for this axis default :General.

@@ -268,9 +262,8 @@ The number format format code for this axis default :General. -

-The scaling of the axis. -

+
+

The scaling of the axis.

@@ -295,9 +288,8 @@ The scaling of the axis. -

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

+
+

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

@@ -334,9 +326,8 @@ the position of the tick labels must be one of [:nextTo, :high, :low]. -

-Creates an Axis object. -

+
+

Creates an Axis object.

@@ -358,9 +349,8 @@ Creates an Axis object. -

-Serializes the common axis. -

+
+

Serializes the common axis.

@@ -381,9 +371,8 @@ Serializes the common axis.

-

-Creates an Axis object -

+ +

Creates an Axis object

@@ -402,9 +391,8 @@ Creates an Axis object — -

-the id of this axis -

+
+

the id of this axis

@@ -419,9 +407,8 @@ the id of this axis — -

-the id of the perpendicular axis -

+
+

the id of the perpendicular axis

@@ -438,9 +425,8 @@ the id of the perpendicular axis — -

-a customizable set of options -

+
+

a customizable set of options

@@ -498,9 +484,8 @@ a customizable set of options — -

-If axId or crossAx are not unsigned integers -

+
+

If axId or crossAx are not unsigned integers

@@ -526,26 +511,27 @@ If axId or crossAx are not unsigned integers 55 56 57 -58 +58 +59
# File 'lib/axlsx/drawing/axis.rb', line 45
 
-def initialize(axId, crossAx, options={})
-  Axlsx::validate_unsigned_int(axId)
-  Axlsx::validate_unsigned_int(crossAx)
-  @axId = axId
-  @crossAx = crossAx
-  @scaling = Scaling.new(:orientation=>:minMax)
-  self.axPos = :l
-  self.tickLblPos = :nextTo
-  self.format_code = "General"
-  self.crosses = :autoZero
-  options.each do |o|
-    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
-  end
-end
-
+def initialize(axId, crossAx, options={}) + Axlsx::validate_unsigned_int(axId) + Axlsx::validate_unsigned_int(crossAx) + @axId = axId + @crossAx = crossAx + @format_code = "General" + @scaling = Scaling.new(:orientation=>:minMax) + self.axPos = :l + self.tickLblPos = :nextTo + self.format_code = "General" + self.crosses = :autoZero + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -568,9 +554,8 @@ If axId or crossAx are not unsigned integers

-

-the id of the axis. -

+ +

the id of the axis.

@@ -604,10 +589,9 @@ the id of the axis.
# File 'lib/axlsx/drawing/axis.rb', line 7
 
-def axId
-  @axId
-end
-
+def axId + @axId +end @@ -625,9 +609,8 @@ the id of the axis.

-

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

+ +

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

@@ -661,10 +644,9 @@ The position of the axis must be one of [:l, :r, :t, :b]
# File 'lib/axlsx/drawing/axis.rb', line 21
 
-def axPos
-  @axPos
-end
-
+def axPos + @axPos +end @@ -682,9 +664,8 @@ The position of the axis must be one of [:l, :r, :t, :b]

-

-The perpendicular axis -

+ +

The perpendicular axis

@@ -718,10 +699,9 @@ The perpendicular axis
# File 'lib/axlsx/drawing/axis.rb', line 11
 
-def crossAx
-  @crossAx
-end
-
+def crossAx + @crossAx +end @@ -739,10 +719,9 @@ The perpendicular axis

-

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

+ +

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

@@ -776,10 +755,9 @@ specifies how the perpendicular axis is crossed must be one of [:autoZero,
# File 'lib/axlsx/drawing/axis.rb', line 36
 
-def crosses
-  @crosses
-end
-
+def crosses + @crosses +end @@ -797,9 +775,8 @@ specifies how the perpendicular axis is crossed must be one of [:autoZero,

-

-The number format format code for this axis default :General -

+ +

The number format format code for this axis default :General

@@ -833,10 +810,9 @@ The number format format code for this axis default :General
# File 'lib/axlsx/drawing/axis.rb', line 31
 
-def format_code
-  @format_code
-end
-
+def format_code + @format_code +end @@ -854,9 +830,8 @@ The number format format code for this axis default :General

-

-The scaling of the axis -

+ +

The scaling of the axis

@@ -897,10 +872,9 @@ The scaling of the axis
# File 'lib/axlsx/drawing/axis.rb', line 16
 
-def scaling
-  @scaling
-end
-
+def scaling + @scaling +end @@ -918,9 +892,8 @@ The scaling of the axis

-

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

+ +

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

@@ -954,10 +927,9 @@ the position of the tick labels must be one of [:nextTo, :high, :low]
# File 'lib/axlsx/drawing/axis.rb', line 26
 
-def tickLblPos
-  @tickLblPos
-end
-
+def tickLblPos + @tickLblPos +end @@ -979,9 +951,8 @@ the position of the tick labels must be one of [:nextTo, :high, :low]

-

-Serializes the common axis -

+ +

Serializes the common axis

@@ -1000,9 +971,8 @@ Serializes the common axis — -

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

+
+

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

@@ -1029,31 +999,30 @@ The document builder instance this objects xml will be added to.
 
 
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
+79 +80 +81 +82 +83 +84 +85 +86 +87 +88 -
# File 'lib/axlsx/drawing/axis.rb', line 68
-
-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
-
+
# File 'lib/axlsx/drawing/axis.rb', line 79
+
+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
@@ -1064,9 +1033,9 @@ The document builder instance this objects xml will be added to.
diff --git a/doc/Axlsx/Bar3DChart.html b/doc/Axlsx/Bar3DChart.html index 1ca256c1..3ad3b313 100644 --- a/doc/Axlsx/Bar3DChart.html +++ b/doc/Axlsx/Bar3DChart.html @@ -6,7 +6,7 @@ Class: Axlsx::Bar3DChart - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,10 +96,9 @@

Overview

-

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

+ +

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

@@ -128,9 +127,8 @@ that you can add to your worksheet.
GAP_AMOUNT_PERCENT =
-

-validation regex for gap amount percent -

+ +

validation regex for gap amount percent

@@ -140,8 +138,7 @@ validation regex for gap amount percent
-
/0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
-
+
/0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
@@ -173,9 +170,8 @@ validation regex for gap amount percent -

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

+
+

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

@@ -200,9 +196,8 @@ The direction of the bars in the chart must be one of [:bar, :col]. -

-the category axis. -

+
+

the category axis.

@@ -227,10 +222,9 @@ the category axis. -

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

+
+

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

@@ -255,10 +249,9 @@ width. -

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

+
+

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

@@ -283,9 +276,8 @@ width. -

-grouping for a column, line, or area chart. -

+
+

grouping for a column, line, or area chart.

@@ -310,10 +302,9 @@ grouping for a column, line, or area chart. -

-The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, -:cylinder, :pyramid, :pyramidToMax]. -

+
+

The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, +:cylinder, :pyramid, :pyramidToMax].

@@ -338,9 +329,8 @@ The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, -

-the valueaxis. -

+
+

the valueaxis.

@@ -356,7 +346,7 @@ the valueaxis.

Attributes inherited from Chart

-

graphic_frame, index, pn, series, series_type, show_legend, style, title, view3D

+

graphic_frame, series, series_type, show_legend, style, title, view3D

@@ -385,9 +375,8 @@ the valueaxis. -

-Creates a new bar chart object. -

+
+

Creates a new bar chart object.

@@ -409,9 +398,8 @@ Creates a new bar chart object. -

-Serializes the bar chart. -

+
+

Serializes the bar chart.

@@ -429,7 +417,7 @@ Serializes the bar chart.

Methods inherited from Chart

-

#add_series, #end_at, #from, #start_at, #to

+

#add_series, #end_at, #from, #index, #pn, #start_at, #to

Constructor Details

@@ -442,9 +430,8 @@ Serializes the bar chart.

-

-Creates a new bar chart object -

+ +

Creates a new bar chart object

@@ -463,9 +450,8 @@ Creates a new bar chart object — -

-The workbook that owns this chart. -

+
+

The workbook that owns this chart.

@@ -482,9 +468,8 @@ The workbook that owns this chart. — -

-a customizable set of options -

+
+

a customizable set of options

@@ -645,23 +630,24 @@ a customizable set of options 68 69 70 -71 +71 +72
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 61
 
-def initialize(frame, options={})
-  @barDir = :bar
-  @grouping = :clustered
-  @catAxId = rand(8 ** 8)
-  @valAxId = rand(8 ** 8)
-  @catAxis = CatAxis.new(@catAxId, @valAxId)
-  @valAxis = ValAxis.new(@valAxId, @catAxId)
-  super(frame, options)      
-  @series_type = BarSeries
-  @view3D = View3D.new({:rAngAx=>1}.merge(options))
-end
-
+def initialize(frame, options={}) + @barDir = :bar + @grouping = :clustered + @gapWidth, @gapDepth, @shape = nil, nil, nil + @catAxId = rand(8 ** 8) + @valAxId = rand(8 ** 8) + @catAxis = CatAxis.new(@catAxId, @valAxId) + @valAxis = ValAxis.new(@valAxId, @catAxId) + super(frame, options) + @series_type = BarSeries + @view3D = View3D.new({:rAngAx=>1}.merge(options)) +end @@ -684,9 +670,8 @@ a customizable set of options

-

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

+ +

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

@@ -720,10 +705,9 @@ The direction of the bars in the chart must be one of [:bar, :col]
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 21
 
-def barDir
-  @barDir
-end
-
+def barDir + @barDir +end @@ -741,9 +725,8 @@ The direction of the bars in the chart must be one of [:bar, :col]

-

-the category axis -

+ +

the category axis

@@ -777,10 +760,9 @@ the category axis
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 12
 
-def catAxis
-  @catAxis
-end
-
+def catAxis + @catAxis +end @@ -798,10 +780,9 @@ the category axis

-

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

+ +

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

@@ -835,10 +816,9 @@ width.
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 25
 
-def gapDepth
-  @gapDepth
-end
-
+def gapDepth + @gapDepth +end @@ -856,10 +836,9 @@ width.

-

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

+ +

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

@@ -893,10 +872,9 @@ width.
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 29
 
-def gapWidth
-  @gapWidth
-end
-
+def gapWidth + @gapWidth +end @@ -914,10 +892,9 @@ width.

-

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

+ +

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

@@ -951,10 +928,9 @@ grouping for a column, line, or area chart. must be one of
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 34
 
-def grouping
-  @grouping
-end
-
+def grouping + @grouping +end @@ -972,10 +948,9 @@ grouping for a column, line, or area chart. must be one of

-

-The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, -:cylinder, :pyramid, :pyramidToMax] -

+ +

The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, +:cylinder, :pyramid, :pyramidToMax]

@@ -1009,10 +984,9 @@ The shabe of the bars or columns must be one of [:cone, :coneToMax, :box,
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 39
 
-def shape
-  @shape
-end
-
+def shape + @shape +end @@ -1030,9 +1004,8 @@ The shabe of the bars or columns must be one of [:cone, :coneToMax, :box,

-

-the valueaxis -

+ +

the valueaxis

@@ -1066,10 +1039,9 @@ the valueaxis
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 16
 
-def valAxis
-  @valAxis
-end
-
+def valAxis + @valAxis +end @@ -1091,9 +1063,8 @@ the valueaxis

-

-Serializes the bar chart -

+ +

Serializes the bar chart

@@ -1120,14 +1091,6 @@ Serializes the bar chart
 
 
-101
-102
-103
-104
-105
-106
-107
-108
 109
 110
 111
@@ -1137,30 +1100,37 @@ Serializes the bar chart
 115
 116
 117
-118
+118 +119 +120 +121 +122 +123 +124 +125 +126 -
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 101
-
-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
-
+
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 109
+
+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
@@ -1171,9 +1141,9 @@ Serializes the bar chart
diff --git a/doc/Axlsx/BarSeries.html b/doc/Axlsx/BarSeries.html index c4a1b690..14660129 100644 --- a/doc/Axlsx/BarSeries.html +++ b/doc/Axlsx/BarSeries.html @@ -6,7 +6,7 @@ Class: Axlsx::BarSeries - — Documentation by YARD 0.7.3 + — AXLSX @@ -99,15 +99,13 @@
Note: -

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

+
+

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

-

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

+ +

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

@@ -152,9 +150,8 @@ A BarSeries defines the title, data and labels for bar charts -

-The data for this series. -

+
+

The data for this series.

@@ -179,9 +176,8 @@ The data for this series. -

-The labels for this series. -

+
+

The labels for this series.

@@ -206,10 +202,9 @@ The labels for this series. -

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

+
+

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

@@ -225,7 +220,7 @@ The shabe of the bars or columns must be one of [:percentStacked,

Attributes inherited from Series

-

chart, index, order, title

+

chart, title

@@ -254,9 +249,8 @@ The shabe of the bars or columns must be one of [:percentStacked, -

-Creates a new series. -

+
+

Creates a new series.

@@ -278,9 +272,8 @@ Creates a new series. -

-Serializes the series. -

+
+

Serializes the series.

@@ -294,7 +287,12 @@ Serializes the series. -
+ + + +

Methods inherited from Series

+

#index, #order, #order=

+

Constructor Details

@@ -306,9 +304,8 @@ Serializes the series.

-

-Creates a new series -

+ +

Creates a new series

@@ -340,9 +337,8 @@ Creates a new series — -

-a customizable set of options -

+
+

a customizable set of options

@@ -413,13 +409,12 @@ a customizable set of options
# File 'lib/axlsx/drawing/bar_series.rb', line 28
 
-def initialize(chart, options={})
-  @shape = :box
-  super(chart, options)
-  self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
-  self.data = ValAxisData.new(options[:data]) unless options[:data].nil?
-end
-
+def initialize(chart, options={}) + @shape = :box + super(chart, options) + self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? + self.data = ValAxisData.new(options[:data]) unless options[:data].nil? +end @@ -442,9 +437,8 @@ a customizable set of options

-

-The data for this series. -

+ +

The data for this series.

@@ -478,10 +472,9 @@ The data for this series.
# File 'lib/axlsx/drawing/bar_series.rb', line 11
 
-def data
-  @data
-end
-
+def data + @data +end @@ -499,9 +492,8 @@ The data for this series.

-

-The labels for this series. -

+ +

The labels for this series.

@@ -535,10 +527,9 @@ The labels for this series.
# File 'lib/axlsx/drawing/bar_series.rb', line 15
 
-def labels
-  @labels
-end
-
+def labels + @labels +end @@ -556,10 +547,9 @@ The labels for this series.

-

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

+ +

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

@@ -593,10 +583,9 @@ The shabe of the bars or columns must be one of [:percentStacked,
# File 'lib/axlsx/drawing/bar_series.rb', line 20
 
-def shape
-  @shape
-end
-
+def shape + @shape +end @@ -618,9 +607,8 @@ The shabe of the bars or columns must be one of [:percentStacked,

-

-Serializes the series -

+ +

Serializes the series

@@ -639,9 +627,8 @@ Serializes the series — -

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

+
+

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

@@ -668,25 +655,24 @@ The document builder instance this objects xml will be added to.
 
 
-43
-44
 45
 46
 47
 48
-49
+49 +50 +51 -
# File 'lib/axlsx/drawing/bar_series.rb', line 43
-
-def to_xml(xml)
-  super(xml) do |xml|
-    @labels.to_xml(xml) unless @labels.nil?
-    @data.to_xml(xml) unless @data.nil?
-    xml.send('c:shape', :val=>@shape)
-  end      
-end
-
+
# File 'lib/axlsx/drawing/bar_series.rb', line 45
+
+def to_xml(xml)
+  super(xml) do |xml_inner|
+    @labels.to_xml(xml_inner) unless @labels.nil?
+    @data.to_xml(xml_inner) unless @data.nil?
+    xml_inner.send('c:shape', :val=>@shape)
+  end      
+end
@@ -697,9 +683,9 @@ The document builder instance this objects xml will be added to.
diff --git a/doc/Axlsx/Border.html b/doc/Axlsx/Border.html index ef0e2b00..26e5cfff 100644 --- a/doc/Axlsx/Border.html +++ b/doc/Axlsx/Border.html @@ -6,7 +6,7 @@ Class: Axlsx::Border - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

Overview

-

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

+ +

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

@@ -128,11 +127,10 @@ This class details a border used in Office Open XML spreadsheet styles. -

-The diagonal down property for the border that indicates if the border +

+

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. -

+cell.

@@ -157,10 +155,9 @@ cell. -

-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. -

+
+

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.

@@ -185,11 +182,10 @@ include a diagonal line from the bottom left to the top right of the cell. -

-The outline property for the border indicating that top, left, right and +

+

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. -

+cells.

@@ -214,9 +210,8 @@ cells. -

-A list of BorderPr objects for this border. -

+
+

A list of BorderPr objects for this border.

@@ -253,9 +248,8 @@ A list of BorderPr objects for this border. -

-Creates a new Border object. -

+
+

Creates a new Border object.

@@ -277,9 +271,8 @@ Creates a new Border object. -

-Serializes the border element. -

+
+

Serializes the border element.

@@ -300,9 +293,8 @@ Serializes the border element.

-

-Creates a new Border object -

+ +

Creates a new Border object

@@ -312,20 +304,18 @@ Creates a new Border object

Examples:

-

-Making a border -

+

+

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
-
+
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:

@@ -343,9 +333,8 @@ Making a border — -

-a customizable set of options -

+
+

a customizable set of options

@@ -405,13 +394,12 @@ a customizable set of options
# 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
-
+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 @@ -434,11 +422,10 @@ a customizable set of options

-

-The diagonal down property for the border that indicates if the border + +

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. -

+cell.

@@ -456,11 +443,10 @@ cell. — -

-The diagonal down property for the border that indicates if the border +

+

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. -

+cell.

@@ -480,10 +466,9 @@ cell.
# File 'lib/axlsx/stylesheet/border.rb', line 9
 
-def diagonalDown
-  @diagonalDown
-end
-
+def diagonalDown + @diagonalDown +end @@ -501,10 +486,9 @@ cell.

-

-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. -

+ +

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.

@@ -522,10 +506,9 @@ include a diagonal line from the bottom left to the top right of the cell. — -

-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. -

+
+

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.

@@ -545,10 +528,9 @@ include a diagonal line from the bottom left to the top right of the cell.
# File 'lib/axlsx/stylesheet/border.rb', line 6
 
-def diagonalUp
-  @diagonalUp
-end
-
+def diagonalUp + @diagonalUp +end @@ -566,11 +548,10 @@ include a diagonal line from the bottom left to the top right of the cell.

-

-The outline property for the border indicating that top, left, right and + +

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. -

+cells.

@@ -588,11 +569,10 @@ cells. — -

-The outline property for the border indicating that top, left, right and +

+

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. -

+cells.

@@ -612,10 +592,9 @@ cells.
# File 'lib/axlsx/stylesheet/border.rb', line 12
 
-def outline
-  @outline
-end
-
+def outline + @outline +end @@ -633,9 +612,8 @@ cells.

-

-A list of BorderPr objects for this border. -

+ +

A list of BorderPr objects for this border.

@@ -653,9 +631,8 @@ A list of BorderPr objects for this border. — -

-A list of BorderPr objects for this border. -

+
+

A list of BorderPr objects for this border.

@@ -675,10 +652,9 @@ A list of BorderPr objects for this border.
# File 'lib/axlsx/stylesheet/border.rb', line 15
 
-def prs
-  @prs
-end
-
+def prs + @prs +end @@ -700,9 +676,8 @@ A list of BorderPr objects for this border.

-

-Serializes the border element -

+ +

Serializes the border element

@@ -721,9 +696,8 @@ Serializes the border element — -

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

+
+

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

@@ -737,25 +711,28 @@ The document builder instance this objects xml will be added to.
 
 
-44
-45
-46
 47
 48
 49
-50
+50 +51 +52 +53 +54 +55 -
# 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
-
+
# File 'lib/axlsx/stylesheet/border.rb', line 47
+
+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 do |part| 
+        part.to_xml(xml) 
+      end
+    end
+  }
+end
@@ -766,9 +743,9 @@ The document builder instance this objects xml will be added to.
diff --git a/doc/Axlsx/BorderPr.html b/doc/Axlsx/BorderPr.html index 2b2941d5..47c49d87 100644 --- a/doc/Axlsx/BorderPr.html +++ b/doc/Axlsx/BorderPr.html @@ -6,7 +6,7 @@ Class: Axlsx::BorderPr - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

Overview

-

-A border part. -

+ +

A border part.

@@ -128,9 +127,8 @@ A border part. -

-The color of this border part. -

+
+

The color of this border part.

@@ -155,9 +153,8 @@ The color of this border part. -

-The name of this border part. -

+
+

The name of this border part.

@@ -182,9 +179,8 @@ The name of this border part. -

-The syle of this border part. -

+
+

The syle of this border part.

@@ -221,9 +217,8 @@ The syle of this border part. -

-Creates a new Border Part Object. -

+
+

Creates a new Border Part Object.

@@ -245,9 +240,8 @@ Creates a new Border Part Object. -

-Serializes the border part. -

+
+

Serializes the border part.

@@ -268,9 +262,8 @@ Serializes the border part.

-

-Creates a new Border Part Object -

+ +

Creates a new Border Part Object

@@ -291,9 +284,8 @@ Creates a new Border Part Object — -

-a customizable set of options -

+
+

a customizable set of options

@@ -359,12 +351,11 @@ a customizable set of options
# 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
-
+def initialize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -387,9 +378,8 @@ a customizable set of options

-

-The color of this border part. -

+ +

The color of this border part.

@@ -407,9 +397,8 @@ The color of this border part. — -

-The color of this border part. -

+
+

The color of this border part.

@@ -429,10 +418,9 @@ The color of this border part.
# File 'lib/axlsx/stylesheet/border_pr.rb', line 6
 
-def color
-  @color
-end
-
+def color + @color +end @@ -453,26 +441,23 @@ The color of this border part.
Note: -

-The following are allowed -

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

The following are allowed

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

-The name of this border part -

+ +

The name of this border part

@@ -490,9 +475,8 @@ The name of this border part — -

-The name of this border part -

+
+

The name of this border part

@@ -512,10 +496,9 @@ The name of this border part
# File 'lib/axlsx/stylesheet/border_pr.rb', line 39
 
-def name
-  @name
-end
-
+def name + @name +end @@ -536,31 +519,28 @@ The name of this border part
Note: -

-The following are allowed -

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

The following are allowed

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

-The syle of this border part. -

+ +

The syle of this border part.

@@ -578,9 +558,8 @@ The syle of this border part. — -

-The syle of this border part. -

+
+

The syle of this border part.

@@ -600,10 +579,9 @@ The syle of this border part.
# File 'lib/axlsx/stylesheet/border_pr.rb', line 25
 
-def style
-  @style
-end
-
+def style + @style +end @@ -625,9 +603,8 @@ The syle of this border part.

-

-Serializes the border part -

+ +

Serializes the border part

@@ -646,9 +623,8 @@ Serializes the border part — -

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

+
+

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

@@ -675,21 +651,20 @@ The document builder instance this objects xml will be added to.
 
 
-59
-60
-61
 62
-63
+63 +64 +65 +66 -
# 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
-
+
# File 'lib/axlsx/stylesheet/border_pr.rb', line 62
+
+def to_xml(xml)
+  xml.send(@name, :style => @style) {
+    @color.to_xml(xml) if @color.is_a? Color
+  } 
+end
@@ -700,9 +675,9 @@ The document builder instance this objects xml will be added to.
diff --git a/doc/Axlsx/CatAxis.html b/doc/Axlsx/CatAxis.html index 667906dd..59b286b7 100644 --- a/doc/Axlsx/CatAxis.html +++ b/doc/Axlsx/CatAxis.html @@ -6,7 +6,7 @@ Class: Axlsx::CatAxis - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,9 +96,8 @@

Overview

-

-A CatAxis object defines a chart category axis -

+ +

A CatAxis object defines a chart category axis

@@ -114,9 +113,8 @@ A CatAxis object defines a chart category axis
LBL_OFFSET_REGEX =
-

-regex for validating label offset -

+ +

regex for validating label offset

@@ -126,8 +124,7 @@ regex for validating label offset
-
/0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)%/
-
+
/0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)%/
@@ -159,10 +156,9 @@ regex for validating label offset -

-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. -

+
+

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.

@@ -187,10 +183,9 @@ based on the data that is used for the axis labels, not a specific choice. -

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

+
+

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

@@ -215,9 +210,8 @@ specifies how the perpendicular axis is crossed must be one of [:ctr, :l, -

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

+
+

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

@@ -262,9 +256,8 @@ The offset of the labels must be between a string between 0 and 1000. -

-Creates a new CatAxis object. -

+
+

Creates a new CatAxis object.

@@ -286,9 +279,8 @@ Creates a new CatAxis object. -

-Serializes the category axis. -

+
+

Serializes the category axis.

@@ -314,9 +306,8 @@ Serializes the category axis.

-

-Creates a new CatAxis object -

+ +

Creates a new CatAxis object

@@ -335,9 +326,8 @@ Creates a new CatAxis object — -

-the id of this axis. Inherited -

+
+

the id of this axis. Inherited

@@ -352,9 +342,8 @@ the id of this axis. Inherited — -

-the id of the perpendicular axis. Inherited -

+
+

the id of the perpendicular axis. Inherited

@@ -371,9 +360,8 @@ the id of the perpendicular axis. Inherited — -

-a customizable set of options -

+
+

a customizable set of options

@@ -396,9 +384,8 @@ a customizable set of options - —

-Inherited -

+ —
+

Inherited

@@ -408,9 +395,8 @@ Inherited - —

-Inherited -

+ —
+

Inherited

@@ -420,9 +406,8 @@ Inherited - —

-Inherited -

+ —
+

Inherited

@@ -473,13 +458,12 @@ Inherited
# File 'lib/axlsx/drawing/cat_axis.rb', line 31
 
-def initialize(axId, crossAx, options={})
-  self.auto = true
-  self.lblAlgn = :ctr
-  self.lblOffset = "100%"
-  super(axId, crossAx, options)
-end
-
+def initialize(axId, crossAx, options={}) + self.auto = true + self.lblAlgn = :ctr + self.lblOffset = "100%" + super(axId, crossAx, options) +end @@ -502,10 +486,9 @@ Inherited

-

-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. -

+ +

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.

@@ -539,10 +522,9 @@ based on the data that is used for the axis labels, not a specific choice.
# File 'lib/axlsx/drawing/cat_axis.rb', line 7
 
-def auto
-  @auto
-end
-
+def auto + @auto +end @@ -560,10 +542,9 @@ based on the data that is used for the axis labels, not a specific choice.

-

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

+ +

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

@@ -597,10 +578,9 @@ specifies how the perpendicular axis is crossed must be one of [:ctr, :l,
# File 'lib/axlsx/drawing/cat_axis.rb', line 12
 
-def lblAlgn
-  @lblAlgn
-end
-
+def lblAlgn + @lblAlgn +end @@ -618,9 +598,8 @@ specifies how the perpendicular axis is crossed must be one of [:ctr, :l,

-

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

+ +

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

@@ -654,10 +633,9 @@ The offset of the labels must be between a string between 0 and 1000
# File 'lib/axlsx/drawing/cat_axis.rb', line 17
 
-def lblOffset
-  @lblOffset
-end
-
+def lblOffset + @lblOffset +end @@ -679,9 +657,8 @@ The offset of the labels must be between a string between 0 and 1000

-

-Serializes the category axis -

+ +

Serializes the category axis

@@ -700,9 +677,8 @@ Serializes the category axis — -

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

+
+

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

@@ -729,27 +705,26 @@ The document builder instance this objects xml will be added to.
 
 
-45
-46
-47
-48
-49
-50
-51
-52
+52 +53 +54 +55 +56 +57 +58 +59 -
# File 'lib/axlsx/drawing/cat_axis.rb', line 45
-
-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
-
+
# File 'lib/axlsx/drawing/cat_axis.rb', line 52
+
+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
@@ -760,9 +735,9 @@ The document builder instance this objects xml will be added to.
diff --git a/doc/Axlsx/CatAxisData.html b/doc/Axlsx/CatAxisData.html index f28b881b..188310aa 100644 --- a/doc/Axlsx/CatAxisData.html +++ b/doc/Axlsx/CatAxisData.html @@ -6,7 +6,7 @@ Class: Axlsx::CatAxisData - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,9 +96,8 @@

Overview

-

-The CatAxisData class serializes the category axis data for a chart -

+ +

The CatAxisData class serializes the category axis data for a chart

@@ -153,9 +152,8 @@ The CatAxisData class serializes the category axis data for a chart -

-Create a new CatAxisData object. -

+
+

Create a new CatAxisData object.

@@ -177,9 +175,8 @@ Create a new CatAxisData object. -

-Serializes the category axis data. -

+
+

Serializes the category axis data.

@@ -193,12 +190,7 @@ Serializes the category axis data. - - - -

Methods inherited from SimpleTypedList

-

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

-
+

Constructor Details

@@ -210,9 +202,8 @@ Serializes the category axis data.

-

-Create a new CatAxisData object -

+ +

Create a new CatAxisData object

@@ -233,10 +224,9 @@ Create a new CatAxisData object — -

-the data for this category axis. This can be a simple array or a simple -typed list of cells. -

+
+

the data for this category axis. This can be a simple array or a simple +typed list of cells.

@@ -259,12 +249,11 @@ typed list of cells.
# File 'lib/axlsx/drawing/cat_axis_data.rb', line 7
 
-def initialize(data=[])
-  super Object
-  @list.concat data if data.is_a?(Array)
-  data.each { |i| @list << i } if data.is_a?(SimpleTypedList)
-end
-
+def initialize(data=[]) + super Object + @list.concat data if data.is_a?(Array) + data.each { |i| @list << i } if data.is_a?(SimpleTypedList) +end @@ -296,9 +285,8 @@ typed list of cells.

-

-Serializes the category axis data -

+ +

Serializes the category axis data

@@ -317,9 +305,8 @@ Serializes the category axis data — -

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

+
+

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

@@ -366,23 +353,22 @@ The document builder instance this objects xml will be added to.
# File 'lib/axlsx/drawing/cat_axis_data.rb', line 16
 
-def to_xml(xml)
-  xml.send('c:cat') {
-    xml.send('c:strRef') {
-      xml.send('c:f', Axlsx::cell_range(@list))
-      xml.send('c:strCache') {
-        xml.send('c:ptCount', :val=>size)
-        each_with_index do |item, index|
-          v = item.is_a?(Cell) ? item.value : item
-          xml.send('c:pt', :idx=>index) {
-            xml.send('c:v', v)
-          }                          
-        end
-      }
-    }
-  }
-end
-
+def to_xml(xml) + xml.send('c:cat') { + xml.send('c:strRef') { + xml.send('c:f', Axlsx::cell_range(@list)) + xml.send('c:strCache') { + xml.send('c:ptCount', :val=>size) + each_with_index do |item, index| + v = item.is_a?(Cell) ? item.value : item + xml.send('c:pt', :idx=>index) { + xml.send('c:v', v) + } + end + } + } + } +end @@ -393,9 +379,9 @@ The document builder instance this objects xml will be added to.
diff --git a/doc/Axlsx/Cell.html b/doc/Axlsx/Cell.html index 3ed4c320..0873021a 100644 --- a/doc/Axlsx/Cell.html +++ b/doc/Axlsx/Cell.html @@ -6,7 +6,7 @@ Class: Axlsx::Cell - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,22 +97,20 @@
Note: -

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

+
+

The recommended way to generate cells is via Worksheet#add_row

-

-A cell in a worksheet. Cell stores inforamation requried to serialize a + +

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. -

+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.

@@ -122,25 +120,23 @@ cell’s type.

Examples:

-

-Manually creating and manipulating Cell objects -

+

+

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]
+      
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
+# 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
+# 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
-
+# 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
@@ -176,9 +172,8 @@ Manually creating and manipulating Cell objects -

-The row this cell belongs to. -

+
+

The row this cell belongs to.

@@ -203,9 +198,8 @@ The row this cell belongs to. -

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

+
+

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

@@ -230,9 +224,8 @@ The index of the cellXfs item to be applied to this cell. -

-The cell’s data type. -

+
+

The cell's data type.

@@ -257,9 +250,8 @@ The cell’s data type. -

-The value of this cell. -

+
+

The value of this cell.

@@ -281,78 +273,6 @@ The value of this cell.
  • - - (Object) cast_value(v) - - - - - - - - - - - - -

    -Cast the value into this cells data type. -

    -
    - -
  • - - -
  • - - - - (Symbol) cell_type_from_value(v) - - - - - - - - - - - - -

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

    -
    - -
  • - - -
  • - - - - (String) col_ref - - - - - - - - - - - - -

    -converts the column index into alphabetical values. -

    -
    - -
  • - - -
  • - - - (Integer) index @@ -366,9 +286,8 @@ converts the column index into alphabetical values. -

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

    +
    +

    The index of the cell in the containing row.

  • @@ -392,9 +311,8 @@ The index of the cell in the containing row. -

    -A new instance of Cell. -

    +
    +

    A new instance of Cell.

    @@ -416,9 +334,8 @@ A new instance of Cell. -

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

    +
    +

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

    @@ -440,9 +357,8 @@ The alpha(column)numeric(row) reference for this sell. -

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

    +
    +

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

    @@ -464,9 +380,8 @@ The absolute alpha(column)numeric(row) reference for this sell. -

    -Serializes the cell. -

    +
    +

    Serializes the cell.

    @@ -487,9 +402,8 @@ Serializes the cell.

    -

    -A new instance of Cell -

    + +

    A new instance of Cell

    @@ -508,9 +422,8 @@ A new instance of Cell — -

    -The row this cell belongs to. -

    +
    +

    The row this cell belongs to.

    @@ -527,9 +440,8 @@ The row this cell belongs to. — -

    -The value associated with this cell. -

    +
    +

    The value associated with this cell.

    @@ -546,9 +458,8 @@ The value associated with this cell. — -

    -a customizable set of options -

    +
    +

    a customizable set of options

    @@ -571,10 +482,9 @@ a customizable set of options - —

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

    + —
    +

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

    @@ -584,10 +494,9 @@ be determined internally based on the vlue provided. - —

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

    + —
    +

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

    @@ -601,29 +510,28 @@ the default style (0) will be applied.
     
     
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    +69 +70 +71 +72 +73 +74 +75 +76 +77 -
    # 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
    -
    +
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 69
    +
    +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
    @@ -646,9 +554,8 @@ the default style (0) will be applied.

    -

    -The row this cell belongs to. -

    + +

    The row this cell belongs to.

    @@ -675,17 +582,16 @@ The row this cell belongs to.
     
     
    -32
     33
    -34
    +34 +35 -
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 32
    +      
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 33
     
    -def row
    -  @row
    -end
    -
    +def row + @row +end
    @@ -703,9 +609,8 @@ The row this cell belongs to.

    -

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

    + +

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

    @@ -739,17 +644,16 @@ The index of the cellXfs item to be applied to this cell.
     
     
    -28
     29
    -30
    +30 +31 -
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 28
    +      
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 29
     
    -def style
    -  @style
    -end
    -
    +def style + @style +end
    @@ -770,26 +674,22 @@ The index of the cellXfs item to be applied to this cell.
    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. -

    +
    +

    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, + +

    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. -

    +the type is automatically determed.

    @@ -807,9 +707,8 @@ the type is automatically determed. — -

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

    +
    +

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

    @@ -826,9 +725,8 @@ The type of data this cell’s value is cast to. — -

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

    +
    +

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

    @@ -855,10 +753,9 @@ Cell.type must be one of [:time, :float, :integer, :string]
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 46
     
    -def type
    -  @type
    -end
    -
    +def type + @type +end @@ -876,9 +773,8 @@ Cell.type must be one of [:time, :float, :integer, :string]

    -

    -The value of this cell. -

    + +

    The value of this cell.

    @@ -896,9 +792,8 @@ The value of this cell. -

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

    +
    +

    casted value based on cell’s type attribute.

    @@ -911,17 +806,16 @@ casted value based on cell’s type attribute.
     
     
    -50
    -51
    -52
    +57 +58 +59 -
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 50
    +      
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 57
     
    -def value
    -  @value
    -end
    -
    +def value + @value +end
    @@ -935,377 +829,7 @@ casted value based on cell’s type attribute.
    -

    - - - (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 @@ -1313,9 +837,8 @@ converts the column index into alphabetical values.

    -

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

    + +

    The index of the cell in the containing row.

    @@ -1333,9 +856,8 @@ The index of the cell in the containing row. — -

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

    +
    +

    The index of the cell in the containing row.

    @@ -1348,17 +870,16 @@ The index of the cell in the containing row.
     
     
    -67
    -68
    -69
    +80 +81 +82 -
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 67
    +      
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 80
     
    -def index
    -  @row.cells.index(self)
    -end
    -
    +def index + @row.cells.index(self) +end
    @@ -1373,9 +894,8 @@ The index of the cell in the containing row.

    -

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

    + +

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

    @@ -1385,12 +905,10 @@ The alpha(column)numeric(row) reference for this sell.

    Examples:

    -

    -Relative Cell Reference -

    +

    +

    Relative Cell Reference

    -
    ws.rows.first.cells.first.r #=> "A1" 
    -
    +
    ws.rows.first.cells.first.r #=> "A1" 
    @@ -1405,9 +923,8 @@ Relative Cell Reference — -

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

    +
    +

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

    @@ -1420,17 +937,16 @@ The alpha(column)numeric(row) reference for this sell.
     
     
    -74
    -75
    -76
    +87 +88 +89 -
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 74
    +      
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 87
     
    -def r
    -  "#{col_ref}#{@row.index+1}"      
    -end
    -
    +def r + "#{col_ref}#{@row.index+1}" +end
    @@ -1445,9 +961,8 @@ The alpha(column)numeric(row) reference for this sell.

    -

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

    + +

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

    @@ -1457,12 +972,10 @@ The absolute alpha(column)numeric(row) reference for this sell.

    Examples:

    -

    -Absolute Cell Reference -

    +

    +

    Absolute Cell Reference

    -
    ws.rows.first.cells.first.r #=> "$A$1" 
    -
    +
    ws.rows.first.cells.first.r #=> "$A$1" 
    @@ -1477,9 +990,8 @@ Absolute Cell Reference — -

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

    +
    +

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

    @@ -1492,17 +1004,16 @@ The absolute alpha(column)numeric(row) reference for this sell.
     
     
    -81
    -82
    -83
    +94 +95 +96 -
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 81
    +      
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 94
     
    -def r_abs
    -  "$#{r.split('').join('$')}"
    -end
    -
    +def r_abs + "$#{r.split('').join('$')}" +end
    @@ -1520,16 +1031,14 @@ The absolute alpha(column)numeric(row) reference for this sell.
    Note: -

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

    +
    +

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

    -

    -Serializes the cell -

    + +

    Serializes the cell

    @@ -1548,9 +1057,8 @@ Serializes the cell — -

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

    +
    +

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

    @@ -1568,9 +1076,8 @@ The document builder instance this objects xml will be added to. — -

    -xml text for the cell -

    +
    +

    xml text for the cell

    @@ -1583,27 +1090,34 @@ xml text for the cell
     
     
    -110
    -111
    -112
    -113
     114
     115
     116
    -117
    +117 +118 +119 +120 +121 +122 +123 +124 +125 -
    # 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.to_s } }
    -  else
    -    xml.c(:r => r, :s => style) { xml.v value }
    -  end
    -end
    -
    +
    # File 'lib/axlsx/workbook/worksheet/cell.rb', line 114
    +
    +def to_xml(xml)
    +  # Both 1.8 and 1.9 return the same 'fast_xf'
    +  # &#12491;&#12507;&#12531;&#12468;
    +  # &#12491;&#12507;&#12531;&#12468;
    +  
    +  # however nokogiri does a nice 'force_encoding' which we shall remove!
    +  if @type == :string 
    +    xml.c(:r => r, :t=>:inlineStr, :s=>style) { xml.is { xml.t @value.to_s } }
    +  else
    +    xml.c(:r => r, :s => style) { xml.v value }
    +  end
    +end
    @@ -1614,9 +1128,9 @@ xml text for the cell
    diff --git a/doc/Axlsx/CellAlignment.html b/doc/Axlsx/CellAlignment.html index 851be85e..a1c73464 100644 --- a/doc/Axlsx/CellAlignment.html +++ b/doc/Axlsx/CellAlignment.html @@ -6,7 +6,7 @@ Class: Axlsx::CellAlignment - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
    Note: -

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

    +
    +

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

    -

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

    + +

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

    @@ -145,9 +143,8 @@ Object. -

    -The horizontal alignment of the cell. -

    +
    +

    The horizontal alignment of the cell.

    @@ -172,9 +169,8 @@ The horizontal alignment of the cell. -

    -The amount of indent. -

    +
    +

    The amount of indent.

    @@ -199,9 +195,8 @@ The amount of indent. -

    -Indicate if the last line should be justified. -

    +
    +

    Indicate if the last line should be justified.

    @@ -226,10 +221,9 @@ Indicate if the last line should be justified. -

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

    +
    +

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

    @@ -254,9 +248,8 @@ Right-to-Left. -

    -The amount of relativeIndent. -

    +
    +

    The amount of relativeIndent.

    @@ -281,9 +274,8 @@ The amount of relativeIndent. -

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

    +
    +

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

    @@ -308,9 +300,8 @@ Indicate if the text should be shrunk to the fit in the cell. -

    -The textRotation of the cell. -

    +
    +

    The textRotation of the cell.

    @@ -335,9 +326,8 @@ The textRotation of the cell. -

    -The vertical alignment of the cell. -

    +
    +

    The vertical alignment of the cell.

    @@ -362,9 +352,8 @@ The vertical alignment of the cell. -

    -Indicate if the text of the cell should wrap. -

    +
    +

    Indicate if the text of the cell should wrap.

    @@ -401,9 +390,8 @@ Indicate if the text of the cell should wrap. -

    -Create a new cell_alignment object. -

    +
    +

    Create a new cell_alignment object.

    @@ -425,9 +413,8 @@ Create a new cell_alignment object. -

    -Serializes the cell alignment. -

    +
    +

    Serializes the cell alignment.

    @@ -448,9 +435,8 @@ Serializes the cell alignment.

    -

    -Create a new cell_alignment object -

    + +

    Create a new cell_alignment object

    @@ -471,9 +457,8 @@ Create a new cell_alignment object — -

    -a customizable set of options -

    +
    +

    a customizable set of options

    @@ -586,12 +571,11 @@ a customizable set of options
    # 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
    -
    +def initialize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -617,25 +601,22 @@ a customizable set of options
    Note: -

    -The horizontal cell alignement style must be one of -

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

    The horizontal cell alignement style must be one of

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

    -The horizontal alignment of the cell. -

    + +

    The horizontal alignment of the cell.

    @@ -669,10 +650,9 @@ The horizontal alignment of the cell.
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 18
     
    -def horizontal
    -  @horizontal
    -end
    -
    +def horizontal + @horizontal +end @@ -690,9 +670,8 @@ The horizontal alignment of the cell.

    -

    -The amount of indent -

    + +

    The amount of indent

    @@ -726,10 +705,9 @@ The amount of indent
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 41
     
    -def indent
    -  @indent
    -end
    -
    +def indent + @indent +end @@ -747,9 +725,8 @@ The amount of indent

    -

    -Indicate if the last line should be justified. -

    + +

    Indicate if the last line should be justified.

    @@ -783,10 +760,9 @@ Indicate if the last line should be justified.
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 49
     
    -def justifyLastLine
    -  @justifyLastLine
    -end
    -
    +def justifyLastLine + @justifyLastLine +end @@ -804,10 +780,9 @@ Indicate if the last line should be justified.

    -

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

    + +

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

    @@ -841,10 +816,9 @@ Right-to-Left
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 60
     
    -def readingOrder
    -  @readingOrder
    -end
    -
    +def readingOrder + @readingOrder +end @@ -862,9 +836,8 @@ Right-to-Left

    -

    -The amount of relativeIndent -

    + +

    The amount of relativeIndent

    @@ -898,10 +871,9 @@ The amount of relativeIndent
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 45
     
    -def relativeIndent
    -  @relativeIndent
    -end
    -
    +def relativeIndent + @relativeIndent +end @@ -919,9 +891,8 @@ The amount of relativeIndent

    -

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

    + +

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

    @@ -955,10 +926,9 @@ Indicate if the text should be shrunk to the fit in the cell.
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 53
     
    -def shrinkToFit
    -  @shrinkToFit
    -end
    -
    +def shrinkToFit + @shrinkToFit +end @@ -976,9 +946,8 @@ Indicate if the text should be shrunk to the fit in the cell.

    -

    -The textRotation of the cell. -

    + +

    The textRotation of the cell.

    @@ -1012,10 +981,9 @@ The textRotation of the cell.
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 33
     
    -def textRotation
    -  @textRotation
    -end
    -
    +def textRotation + @textRotation +end @@ -1036,22 +1004,19 @@ The textRotation of the cell.
    Note: -

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

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

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

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

    -The vertical alignment of the cell. -

    + +

    The vertical alignment of the cell.

    @@ -1085,10 +1050,9 @@ The vertical alignment of the cell.
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 29
     
    -def vertical
    -  @vertical
    -end
    -
    +def vertical + @vertical +end @@ -1106,9 +1070,8 @@ The vertical alignment of the cell.

    -

    -Indicate if the text of the cell should wrap -

    + +

    Indicate if the text of the cell should wrap

    @@ -1142,10 +1105,9 @@ Indicate if the text of the cell should wrap
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 37
     
    -def wrapText
    -  @wrapText
    -end
    -
    +def wrapText + @wrapText +end @@ -1167,9 +1129,8 @@ Indicate if the text of the cell should wrap

    -

    -Serializes the cell alignment -

    + +

    Serializes the cell alignment

    @@ -1188,9 +1149,8 @@ Serializes the cell alignment — -

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

    +
    +

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

    @@ -1217,17 +1177,16 @@ The document builder instance this objects xml will be added to.
     
     
    -91
    -92
    -93
    +100 +101 +102 -
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 91
    +      
    # File 'lib/axlsx/stylesheet/cell_alignment.rb', line 100
     
    -def to_xml(xml)
    -  xml.alignment(self.instance_values)      
    -end
    -
    +def to_xml(xml) + xml.alignment(self.instance_values) +end
    @@ -1238,9 +1197,9 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/CellProtection.html b/doc/Axlsx/CellProtection.html index 089ca4b4..a62fe369 100644 --- a/doc/Axlsx/CellProtection.html +++ b/doc/Axlsx/CellProtection.html @@ -6,7 +6,7 @@ Class: Axlsx::CellProtection - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
    Note: -

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

    +
    +

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

    -

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

    + +

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

    @@ -145,9 +143,8 @@ spreadsheet. -

    -specifies locking for cells that have the style containing this protection. -

    +
    +

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

    @@ -172,9 +169,8 @@ specifies locking for cells that have the style containing this protection. -

    -specifies if the cells that have the style containing this protection. -

    +
    +

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

    @@ -211,9 +207,8 @@ specifies if the cells that have the style containing this protection. -

    -Creates a new CellProtection. -

    +
    +

    Creates a new CellProtection.

    @@ -235,9 +230,8 @@ Creates a new CellProtection. -

    -Serializes the cell protection. -

    +
    +

    Serializes the cell protection.

    @@ -258,9 +252,8 @@ Serializes the cell protection.

    -

    -Creates a new CellProtection -

    + +

    Creates a new CellProtection

    @@ -281,9 +274,8 @@ Creates a new CellProtection — -

    -a customizable set of options -

    +
    +

    a customizable set of options

    @@ -302,9 +294,8 @@ a customizable set of options - —

    -value for hidden protection -

    + —
    +

    value for hidden protection

    @@ -314,9 +305,8 @@ value for hidden protection - —

    -value for locked protection -

    + —
    +

    value for locked protection

    @@ -339,12 +329,11 @@ value for locked protection
    # 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
    -
    +def initialize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -367,9 +356,8 @@ value for locked protection

    -

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

    + +

    specifies locking for cells that have the style containing this protection

    @@ -403,10 +391,9 @@ specifies locking for cells that have the style containing this protection
    # File 'lib/axlsx/stylesheet/cell_protection.rb', line 9
     
    -def 
    -  @hidden
    -end
    -
    +def + @hidden +end @@ -424,9 +411,8 @@ specifies locking for cells that have the style containing this protection

    -

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

    + +

    specifies if the cells that have the style containing this protection

    @@ -460,10 +446,9 @@ specifies if the cells that have the style containing this protection
    # File 'lib/axlsx/stylesheet/cell_protection.rb', line 13
     
    -def locked
    -  @locked
    -end
    -
    +def locked + @locked +end @@ -485,9 +470,8 @@ specifies if the cells that have the style containing this protection

    -

    -Serializes the cell protection -

    + +

    Serializes the cell protection

    @@ -506,9 +490,8 @@ Serializes the cell protection — -

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

    +
    +

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

    @@ -535,17 +518,16 @@ The document builder instance this objects xml will be added to.
     
     
    -29
    -30
    -31
    +32 +33 +34 -
    # File 'lib/axlsx/stylesheet/cell_protection.rb', line 29
    +      
    # File 'lib/axlsx/stylesheet/cell_protection.rb', line 32
     
    -def to_xml(xml)
    -  xml.protection(self.instance_values)
    -end
    -
    +def to_xml(xml) + xml.protection(self.instance_values) +end
    @@ -556,9 +538,9 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/CellStyle.html b/doc/Axlsx/CellStyle.html index 6bf38863..33981c3b 100644 --- a/doc/Axlsx/CellStyle.html +++ b/doc/Axlsx/CellStyle.html @@ -6,7 +6,7 @@ Class: Axlsx::CellStyle - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
    Note: -

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

    +
    +

    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. -

    + +

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

    @@ -145,9 +143,8 @@ and can be used in your worksheet. -

    -The buildinId to use when this named style is applied. -

    +
    +

    The buildinId to use when this named style is applied.

    @@ -172,9 +169,8 @@ The buildinId to use when this named style is applied. -

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

    +
    +

    Indicates that the build in style reference has been customized.

    @@ -199,10 +195,9 @@ Indicates that the build in style reference has been customized. -

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

    +
    +

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

    @@ -227,10 +222,9 @@ excel. -

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

    +
    +

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

    @@ -255,9 +249,8 @@ the outline it is to be applied to. -

    -The name of this cell style. -

    +
    +

    The name of this cell style.

    @@ -282,9 +275,8 @@ The name of this cell style. -

    -The formatting record id this named style utilizes. -

    +
    +

    The formatting record id this named style utilizes.

    @@ -321,9 +313,8 @@ The formatting record id this named style utilizes. -

    -Creats a new CellStyle object. -

    +
    +

    Creats a new CellStyle object.

    @@ -345,9 +336,8 @@ Creats a new CellStyle object. -

    -Serializes the cell style. -

    +
    +

    Serializes the cell style.

    @@ -368,9 +358,8 @@ Serializes the cell style.

    -

    -Creats a new CellStyle object -

    + +

    Creats a new CellStyle object

    @@ -391,9 +380,8 @@ Creats a new CellStyle object — -

    -a customizable set of options -

    +
    +

    a customizable set of options

    @@ -479,12 +467,11 @@ a customizable set of options
    # 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
    -
    +def initialize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] + end +end @@ -507,9 +494,8 @@ a customizable set of options

    -

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

    + +

    The buildinId to use when this named style is applied

    @@ -550,10 +536,9 @@ The buildinId to use when this named style is applied
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 18
     
    -def builtinId
    -  @builtinId
    -end
    -
    +def builtinId + @builtinId +end @@ -571,9 +556,8 @@ The buildinId to use when this named style is applied

    -

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

    + +

    Indicates that the build in style reference has been customized.

    @@ -607,10 +591,9 @@ Indicates that the build in style reference has been customized.
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 30
     
    -def customBuiltin
    -  @customBuiltin
    -end
    -
    +def customBuiltin + @customBuiltin +end @@ -628,10 +611,9 @@ Indicates that the build in style reference has been customized.

    -

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

    + +

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

    @@ -665,10 +647,9 @@ excel
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 26
     
    -def 
    -  @hidden
    -end
    -
    +def + @hidden +end @@ -686,10 +667,9 @@ excel

    -

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

    + +

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

    @@ -723,10 +703,9 @@ the outline it is to be applied to.
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 22
     
    -def iLevel
    -  @iLevel
    -end
    -
    +def iLevel + @iLevel +end @@ -744,9 +723,8 @@ the outline it is to be applied to.

    -

    -The name of this cell style -

    + +

    The name of this cell style

    @@ -780,10 +758,9 @@ The name of this cell style
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 8
     
    -def name
    -  @name
    -end
    -
    +def name + @name +end @@ -801,9 +778,8 @@ The name of this cell style

    -

    -The formatting record id this named style utilizes -

    + +

    The formatting record id this named style utilizes

    @@ -844,10 +820,9 @@ The formatting record id this named style utilizes
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 13
     
    -def xfId
    -  @xfId
    -end
    -
    +def xfId + @xfId +end @@ -869,9 +844,8 @@ The formatting record id this named style utilizes

    -

    -Serializes the cell style -

    + +

    Serializes the cell style

    @@ -890,9 +864,8 @@ Serializes the cell style — -

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

    +
    +

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

    @@ -919,17 +892,16 @@ The document builder instance this objects xml will be added to.
     
     
    -55
    -56
    -57
    +60 +61 +62 -
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 55
    +      
    # File 'lib/axlsx/stylesheet/cell_style.rb', line 60
     
    -def to_xml(xml)
    -  xml.cellStyle(self.instance_values)
    -end
    -
    +def to_xml(xml) + xml.cellStyle(self.instance_values) +end
    @@ -940,9 +912,9 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/Chart.html b/doc/Axlsx/Chart.html index d0782980..77914e8a 100644 --- a/doc/Axlsx/Chart.html +++ b/doc/Axlsx/Chart.html @@ -6,7 +6,7 @@ Class: Axlsx::Chart - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
    Note: -

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

    +
    +

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

    -

    -A Chart is the superclass for specific charts -

    + +

    A Chart is the superclass for specific charts

    @@ -149,9 +147,8 @@ A Chart is the superclass for specific charts -

    -A reference to the graphic frame that owns this chart. -

    +
    +

    A reference to the graphic frame that owns this chart.

    @@ -160,7 +157,7 @@ A reference to the graphic frame that owns this chart.
  • - - (Integer) index + - (SimpleTypedList) series @@ -176,9 +173,8 @@ A reference to the graphic frame that owns this chart. -

    -The index of this chart in the workbooks charts collection. -

    +
    +

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

  • @@ -187,7 +183,7 @@ The index of this chart in the workbooks charts collection.
  • - - (String) pn + - (Series) series_type @@ -203,9 +199,8 @@ The index of this chart in the workbooks charts collection. -

    -The part name for this chart. -

    +
    +

    The type of series to use for this chart.

  • @@ -214,14 +209,14 @@ The part name for this chart.
  • - - (SimpleTypedList) series + - (Boolean) show_legend - readonly + @@ -230,9 +225,8 @@ The part name for this chart. -

    -A collection of series objects that are applied to the chart. -

    +
    +

    Show the legend in the chart.

  • @@ -241,14 +235,14 @@ A collection of series objects that are applied to the chart.
  • - - (Series) series_type + - (Integer) style - readonly + @@ -257,9 +251,8 @@ A collection of series objects that are applied to the chart. -

    -The type of series to use for this chart. -

    +
    +

    The style for the chart.

  • @@ -268,7 +261,7 @@ The type of series to use for this chart.
  • - - (Boolean) show_legend + - (Title) title @@ -284,9 +277,8 @@ The type of series to use for this chart. -

    -Show the legend in the chart. -

    +
    +

    The title object for the chart.

  • @@ -295,7 +287,7 @@ Show the legend in the chart.
  • - - (Integer) style + - (Object) view3D @@ -311,85 +303,77 @@ Show the legend in the chart. -

    -The style for the chart. -

    +
    +

    The 3D view properties for the chart.

  • -
  • + + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (Series) add_series(options = {}) + - (Object) from @@ -402,9 +386,9 @@ The 3D view properties for the chart. -

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

      +
      +

      backwards compatibility to allow chart.to and chart.from access to anchor +markers.

    • @@ -413,7 +397,7 @@ Adds a new series to the chart’s series collection.
    • - - (Marker) end_at(x, y) + - (Integer) index @@ -426,10 +410,8 @@ Adds a new series to the chart’s series collection. -

      -This is a short cut method to set the end anchor position If you need finer -granularity in positioning use graphic_frame.anchor.to.colOff / rowOff. -

      +
      +

      The index of this chart in the workbooks charts collection.

    • @@ -438,12 +420,14 @@ granularity in positioning use graphic_frame.anchor.to.colOff / rowOff.
    • - - (Object) from + - (Chart) initialize(frame, options = {}) {|_self| ... } + constructor + @@ -451,10 +435,8 @@ granularity in positioning use graphic_frame.anchor.to.colOff / rowOff. -

      -backwards compatibility to allow chart.to and chart.from access to anchor -markers. -

      +
      +

      Creates a new chart object.

    • @@ -463,14 +445,12 @@ markers.
    • - - (Chart) initialize(frame, options = {}) {|_self| ... } + - (String) pn - constructor - @@ -478,9 +458,8 @@ markers. -

      -Creates a new chart object. -

      +
      +

      The part name for this chart.

    • @@ -502,11 +481,10 @@ Creates a new chart object. -

      -This is a short cut method to set the start anchor position If you need +

      +

      This is a short cut method to set the start anchor position If you need finer granularity in positioning use graphic_frame.anchor.from.colOff / -rowOff. -

      +rowOff.

      @@ -528,10 +506,9 @@ rowOff. -

      -backwards compatibility to allow chart.to and chart.from access to anchor -markers. -

      +
      +

      backwards compatibility to allow chart.to and chart.from access to anchor +markers.

      @@ -553,9 +530,8 @@ markers. -

      -Chart Serialization serializes the chart. -

      +
      +

      Chart Serialization serializes the chart.

      @@ -576,9 +552,8 @@ Chart Serialization serializes the chart.

      -

      -Creates a new chart object -

      + +

      Creates a new chart object

      @@ -597,9 +572,8 @@ Creates a new chart object — -

      -The frame that holds this chart. -

      +
      +

      The frame that holds this chart.

      @@ -616,9 +590,8 @@ The frame that holds this chart. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -680,9 +653,8 @@ a customizable set of options — -

      -the object that the method was called on -

      +
      +

      the object that the method was called on

      @@ -695,39 +667,38 @@ the object that the method was called on
       
       
      +44
      +45
      +46
      +47
      +48
      +49
      +50
      +51
       52
       53
       54
       55
       56
      -57
      -58
      -59
      -60
      -61
      -62
      -63
      -64
      -65
      +57 -
      # File 'lib/axlsx/drawing/chart.rb', line 52
      -
      -def initialize(frame, options={})
      -  @style = 2
      -  @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
      -  start_at *options[:start_at] if options[:start_at]
      -  end_at *options[:end_at] if options[:start_at]
      -  yield self if block_given?
      -end
      -
      +
      # File 'lib/axlsx/drawing/chart.rb', line 44
      +
      +def initialize(frame, options={})
      +  @style = 2
      +  @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
      +  start_at(*options[:start_at]) if options[:start_at]
      +  end_at(*options[:end_at]) if options[:start_at]
      +  yield self if block_given?
      +end
      @@ -750,9 +721,8 @@ the object that the method was called on

      -

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

      + +

      A reference to the graphic frame that owns this chart

      @@ -786,124 +756,9 @@ A reference to the graphic frame that owns this chart
      # File 'lib/axlsx/drawing/chart.rb', line 14
       
      -def graphic_frame
      -  @graphic_frame
      -end
      -
      - - - -
      - - - - -
      -

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

      -
      -

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

      - - -
      -
      -
      - -

      Returns:

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

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

      -
      -

      -The part name for this chart -

      - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (String) - - - -
      • - -
      - -
      - - -
      -
      -
      -
      -30
      -31
      -32
      -
      -
      # File 'lib/axlsx/drawing/chart.rb', line 30
      -
      -def pn
      -  "#{CHART_PN % (index+1)}"
      -end
      -
      +def graphic_frame + @graphic_frame +end
      @@ -921,9 +776,8 @@ The part name for this chart

      -

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

      + +

      A collection of series objects that are applied to the chart

      @@ -957,10 +811,9 @@ A collection of series objects that are applied to the chart
      # File 'lib/axlsx/drawing/chart.rb', line 18
       
      -def series
      -  @series
      -end
      -
      +def series + @series +end @@ -978,9 +831,8 @@ A collection of series objects that are applied to the chart

      -

      -The type of series to use for this chart. -

      + +

      The type of series to use for this chart.

      @@ -1014,10 +866,9 @@ The type of series to use for this chart.
      # File 'lib/axlsx/drawing/chart.rb', line 22
       
      -def series_type
      -  @series_type
      -end
      -
      +def series_type + @series_type +end @@ -1035,9 +886,8 @@ The type of series to use for this chart.

      -

      -Show the legend in the chart -

      + +

      Show the legend in the chart

      @@ -1064,17 +914,16 @@ Show the legend in the chart
       
       
      -46
      -47
      -48
      +38 +39 +40 -
      # File 'lib/axlsx/drawing/chart.rb', line 46
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 38
       
      -def show_legend
      -  @show_legend
      -end
      -
      +def show_legend + @show_legend +end
      @@ -1092,9 +941,8 @@ Show the legend in the chart

      -

      -The style for the chart. see ECMA Part 1 §21.2.2.196 -

      + +

      The style for the chart. see ECMA Part 1 §21.2.2.196

      @@ -1121,17 +969,16 @@ The style for the chart. see ECMA Part 1 §21.2.2.196
       
       
      -42
      -43
      -44
      +34 +35 +36 -
      # File 'lib/axlsx/drawing/chart.rb', line 42
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 34
       
      -def style
      -  @style
      -end
      -
      +def style + @style +end
      @@ -1149,9 +996,8 @@ The style for the chart. see ECMA Part 1 §21.2.2.196

      -

      -The title object for the chart. -

      + +

      The title object for the chart.

      @@ -1178,17 +1024,16 @@ The title object for the chart.
       
       
      -37
      -38
      -39
      +29 +30 +31 -
      # File 'lib/axlsx/drawing/chart.rb', line 37
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 29
       
      -def title
      -  @title
      -end
      -
      +def title + @title +end
      @@ -1206,9 +1051,8 @@ The title object for the chart.

      -

      -The 3D view properties for the chart -

      + +

      The 3D view properties for the chart

      @@ -1229,10 +1073,9 @@ The 3D view properties for the chart
      # File 'lib/axlsx/drawing/chart.rb', line 10
       
      -def view3D
      -  @view3D
      -end
      -
      +def view3D + @view3D +end @@ -1254,9 +1097,8 @@ The 3D view properties for the chart

      -

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

      + +

      Adds a new series to the chart's series collection.

      @@ -1290,19 +1132,18 @@ Adds a new series to the chart’s series collection.
       
       
      -100
      -101
      -102
      -103
      +106 +107 +108 +109 -
      # File 'lib/axlsx/drawing/chart.rb', line 100
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 106
       
      -def add_series(options={})
      -  @series_type.new(self, options)
      -  @series.last
      -end
      -
      +def add_series(options={}) + @series_type.new(self, options) + @series.last +end
      @@ -1317,10 +1158,9 @@ Adds a new series to the chart’s series collection.

      -

      -This is a short cut method to set the end anchor position If you need finer -granularity in positioning use graphic_frame.anchor.to.colOff / rowOff -

      + +

      This is a short cut method to set the end anchor position If you need finer +granularity in positioning use graphic_frame.anchor.to.colOff / rowOff

      @@ -1339,9 +1179,8 @@ granularity in positioning use graphic_frame.anchor.to.colOff / rowOff — -

      -The column -

      +
      +

      The column

      @@ -1356,9 +1195,8 @@ The column — -

      -The row -

      +
      +

      The row

      @@ -1385,19 +1223,18 @@ The row
       
       
      -148
      -149
      -150
      -151
      +154 +155 +156 +157 -
      # File 'lib/axlsx/drawing/chart.rb', line 148
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 154
       
      -def end_at(x, y)
      -  @graphic_frame.anchor.to.col = x
      -  @graphic_frame.anchor.to.row = y
      -end
      -
      +def end_at(x, y) + @graphic_frame.anchor.to.col = x + @graphic_frame.anchor.to.row = y +end
      @@ -1415,16 +1252,14 @@ The row
      Note: -

      -This will be disconinued in version 2.0.0. please use the start_at method -

      +
      +

      This will be disconinued in version 2.0.0. please use the start_at method

      -

      -backwards compatibility to allow chart.to and chart.from access to anchor -markers -

      + +

      backwards compatibility to allow chart.to and chart.from access to anchor +markers

      @@ -1438,17 +1273,120 @@ markers
       
       
      -93
      -94
      -95
      +99 +100 +101 -
      # File 'lib/axlsx/drawing/chart.rb', line 93
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 99
      +
      +def from
      +  @graphic_frame.anchor.from
      +end
      + + + +
      + +
      +

      + + - (Integer) index + + + +

      +
      + +

      The index of this chart in the workbooks charts collection

      + + +
      +
      +
      + +

      Returns:

      +
        + +
      • + + + (Integer) + + + +
      • + +
      + +
      + + + + +
      +
      +
      +
      +61
      +62
      +63
      +
      +
      # File 'lib/axlsx/drawing/chart.rb', line 61
       
      -def from
      -  @graphic_frame.anchor.from
      -end
      -
      +def index + @graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self) +end +
      +
      + +
      +

      + + - (String) pn + + + +

      +
      + +

      The part name for this chart

      + + +
      +
      +
      + +

      Returns:

      +
        + +
      • + + + (String) + + + +
      • + +
      + +
      + + +
      +
      +
      +
      +67
      +68
      +69
      +
      +
      # File 'lib/axlsx/drawing/chart.rb', line 67
      +
      +def pn
      +  "#{CHART_PN % (index+1)}"
      +end
      @@ -1463,11 +1401,10 @@ markers

      -

      -This is a short cut method to set the start anchor position If you need + +

      This is a short cut method to set the start anchor position If you need finer granularity in positioning use graphic_frame.anchor.from.colOff / -rowOff -

      +rowOff

      @@ -1486,9 +1423,8 @@ rowOff — -

      -The column -

      +
      +

      The column

      @@ -1503,9 +1439,8 @@ The column — -

      -The row -

      +
      +

      The row

      @@ -1532,19 +1467,18 @@ The row
       
       
      -137
      -138
      -139
      -140
      +143 +144 +145 +146 -
      # File 'lib/axlsx/drawing/chart.rb', line 137
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 143
       
      -def start_at(x, y)
      -  @graphic_frame.anchor.from.col = x
      -  @graphic_frame.anchor.from.row = y
      -end
      -
      +def start_at(x, y) + @graphic_frame.anchor.from.col = x + @graphic_frame.anchor.from.row = y +end
      @@ -1562,16 +1496,14 @@ The row
      Note: -

      -This will be disconinued in version 2.0.0. Please use the end_at method -

      +
      +

      This will be disconinued in version 2.0.0. Please use the end_at method

      -

      -backwards compatibility to allow chart.to and chart.from access to anchor -markers -

      + +

      backwards compatibility to allow chart.to and chart.from access to anchor +markers

      @@ -1585,17 +1517,16 @@ markers
       
       
      -87
      -88
      -89
      +93 +94 +95 -
      # File 'lib/axlsx/drawing/chart.rb', line 87
      +      
      # File 'lib/axlsx/drawing/chart.rb', line 93
       
      -def to
      -  @graphic_frame.anchor.to
      -end
      -
      +def to + @graphic_frame.anchor.to +end
      @@ -1610,9 +1541,8 @@ markers

      -

      -Chart Serialization serializes the chart -

      + +

      Chart Serialization serializes the chart

      @@ -1626,12 +1556,6 @@ Chart Serialization serializes the chart
       
       
      -107
      -108
      -109
      -110
      -111
      -112
       113
       114
       115
      @@ -1648,35 +1572,40 @@ Chart Serialization serializes the chart
       126
       127
       128
      -129
      +129 +130 +131 +132 +133 +134 +135 -
      # File 'lib/axlsx/drawing/chart.rb', line 107
      -
      -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:date1904', :val=>Axlsx::Workbook.date1904)
      -      xml.send('c:style', :val=>style)
      -      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
      -
      +
      # File 'lib/axlsx/drawing/chart.rb', line 113
      +
      +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:date1904', :val=>Axlsx::Workbook.date1904)
      +      xml.send('c:style', :val=>style)
      +      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
      @@ -1687,9 +1616,9 @@ Chart Serialization serializes the chart
      diff --git a/doc/Axlsx/Color.html b/doc/Axlsx/Color.html index 5bfd584e..30d44a38 100644 --- a/doc/Axlsx/Color.html +++ b/doc/Axlsx/Color.html @@ -6,7 +6,7 @@ Class: Axlsx::Color - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

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

      + +

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

      @@ -128,9 +127,8 @@ The color class represents a color used for borders, fills an fonts -

      -Determines if the color is system color dependant. -

      +
      +

      Determines if the color is system color dependant.

      @@ -155,9 +153,8 @@ Determines if the color is system color dependant. -

      -The color as defined in rgb terms. -

      +
      +

      The color as defined in rgb terms.

      @@ -182,9 +179,8 @@ The color as defined in rgb terms. -

      -The tint value. -

      +
      +

      The tint value.

      @@ -221,9 +217,8 @@ The tint value. -

      -Creates a new Color object. -

      +
      +

      Creates a new Color object.

      @@ -245,9 +240,8 @@ Creates a new Color object. -

      -Serializes the color. -

      +
      +

      Serializes the color.

      @@ -268,9 +262,8 @@ Serializes the color.

      -

      -Creates a new Color object -

      + +

      Creates a new Color object

      @@ -291,9 +284,8 @@ Creates a new Color object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -353,13 +345,12 @@ a customizable set of options
      # 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
      -
      +def initialize(options={}) + @rgb = "FF000000" + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] + end +end @@ -382,9 +373,8 @@ a customizable set of options

      -

      -Determines if the color is system color dependant -

      + +

      Determines if the color is system color dependant

      @@ -418,10 +408,9 @@ Determines if the color is system color dependant
      # File 'lib/axlsx/stylesheet/color.rb', line 6
       
      -def auto
      -  @auto
      -end
      -
      +def auto + @auto +end @@ -442,16 +431,14 @@ Determines if the color is system color dependant
      Note: -

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

      +
      +

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

      -

      -The color as defined in rgb terms. -

      + +

      The color as defined in rgb terms.

      @@ -461,13 +448,11 @@ The color as defined in rgb terms.

      Examples:

      -

      -rgb colors -

      +

      +

      rgb colors

      -
      "FF000000" is black
      -"FFFFFFFF" is white
      -
      +
      "FF000000" is black
      +"FFFFFFFF" is white
      @@ -498,10 +483,9 @@ rgb colors
      # File 'lib/axlsx/stylesheet/color.rb', line 19
       
      -def rgb
      -  @rgb
      -end
      -
      +def rgb + @rgb +end @@ -522,15 +506,13 @@ rgb colors
      Note: -

      -valid values are between -1.0 and 1.0 -

      +
      +

      valid values are between -1.0 and 1.0

      -

      -The tint value. -

      + +

      The tint value.

      @@ -564,10 +546,9 @@ The tint value.
      # File 'lib/axlsx/stylesheet/color.rb', line 28
       
      -def tint
      -  @tint
      -end
      -
      +def tint + @tint +end @@ -589,9 +570,8 @@ The tint value.

      -

      -Serializes the color -

      + +

      Serializes the color

      @@ -610,9 +590,8 @@ Serializes the color — -

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

      +
      +

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

      @@ -639,13 +618,12 @@ The document builder instance this objects xml will be added to.
       
       
      -55
      +57 -
      # File 'lib/axlsx/stylesheet/color.rb', line 55
      +      
      # File 'lib/axlsx/stylesheet/color.rb', line 57
       
      -def to_xml(xml) xml.color(self.instance_values) end
      -
      +def to_xml(xml) xml.color(self.instance_values) end
      @@ -656,9 +634,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/ContentType.html b/doc/Axlsx/ContentType.html index 428c4f6d..d0b1de57 100644 --- a/doc/Axlsx/ContentType.html +++ b/doc/Axlsx/ContentType.html @@ -6,7 +6,7 @@ Class: Axlsx::ContentType - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,10 +96,9 @@

      Overview

      -

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

      + +

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

      @@ -150,9 +149,8 @@ package package. -

      -A new instance of ContentType. -

      +
      +

      A new instance of ContentType.

      @@ -174,9 +172,8 @@ A new instance of ContentType. -

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

      +
      +

      Generates the xml document for [Content_Types].xml.

      @@ -190,12 +187,7 @@ Generates the xml document for [Content_Types].xml. - - - -

      Methods inherited from SimpleTypedList

      -

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

      -
      +

      Constructor Details

      @@ -207,9 +199,8 @@ Generates the xml document for [Content_Types].xml.

      -

      -A new instance of ContentType -

      + +

      A new instance of ContentType

      @@ -230,10 +221,9 @@ A new instance of ContentType
      # File 'lib/axlsx/content_type/content_type.rb', line 8
       
      -def initialize
      -  super [Override, Default]
      -end
      -
      +def initialize + super [Override, Default] +end @@ -265,9 +255,8 @@ A new instance of ContentType

      -

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

      + +

      Generates the xml document for [Content_Types].xml

      @@ -285,9 +274,8 @@ Generates the xml document for [Content_Types].xml — -

      -The document as a string. -

      +
      +

      The document as a string.

      @@ -312,15 +300,14 @@ The document as a string.
      # 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
      -
      +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 @@ -331,9 +318,9 @@ The document as a string.
      diff --git a/doc/Axlsx/Core.html b/doc/Axlsx/Core.html index 53b07924..b64268ea 100644 --- a/doc/Axlsx/Core.html +++ b/doc/Axlsx/Core.html @@ -6,7 +6,7 @@ Class: Axlsx::Core - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,15 +97,13 @@
      Note: -

      -Packages manage their own core object. -

      +
      +

      Packages manage their own core object.

      -

      -The core object for the package. -

      + +

      The core object for the package.

      @@ -144,9 +142,8 @@ The core object for the package. -

      -The author of the document. -

      +
      +

      The author of the document.

      @@ -183,9 +180,8 @@ The author of the document. -

      -Creates a new Core object. -

      +
      +

      Creates a new Core object.

      @@ -207,9 +203,8 @@ Creates a new Core object. -

      -Serializes the core object. -

      +
      +

      Serializes the core object.

      @@ -230,9 +225,8 @@ Serializes the core object.

      -

      -Creates a new Core object. -

      + +

      Creates a new Core object.

      @@ -253,9 +247,8 @@ Creates a new Core object. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -294,10 +287,9 @@ a customizable set of options
      # File 'lib/axlsx/doc_props/core.rb', line 12
       
      -def initialize(options={})
      -  @creator = options[:creator] || 'axlsx'      
      -end
      -
      +def initialize(options={}) + @creator = options[:creator] || 'axlsx' +end @@ -320,9 +312,8 @@ a customizable set of options

      -

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

      + +

      The author of the document. By default this is 'axlsx'

      @@ -356,10 +347,9 @@ The author of the document. By default this is ‘axlsx’
      # File 'lib/axlsx/doc_props/core.rb', line 8
       
      -def creator
      -  @creator
      -end
      -
      +def creator + @creator +end @@ -381,10 +371,9 @@ The author of the document. By default this is ‘axlsx’

      -

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

      + +

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

      @@ -430,22 +419,21 @@ time when this method is called.
      # 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
      -
      +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 @@ -456,9 +444,9 @@ time when this method is called.
      diff --git a/doc/Axlsx/DataTypeValidator.html b/doc/Axlsx/DataTypeValidator.html index b74915de..51a6b741 100644 --- a/doc/Axlsx/DataTypeValidator.html +++ b/doc/Axlsx/DataTypeValidator.html @@ -6,7 +6,7 @@ Class: Axlsx::DataTypeValidator - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,11 +94,10 @@

      Overview

      -

      -Validate that the class of the value provided is either an instance or the + +

      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. -

      +returns true.

      @@ -122,7 +121,7 @@ returns true.
    • - + (Boolean) validate(name, types, v, other = lambda{|v| true }) + + (Boolean) validate(name, types, v, other = lambda{|arg| true }) @@ -135,9 +134,8 @@ returns true. -

      -Perform validation. -

      +
      +

      Perform validation.

    • @@ -155,15 +153,14 @@ Perform validation.

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

      -

      -Perform validation -

      + +

      Perform validation

      @@ -182,9 +179,8 @@ Perform validation — -

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

      +
      +

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

      @@ -199,9 +195,8 @@ The name of what is being validated. This is included in the error message — -

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

      +
      +

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

      @@ -214,13 +209,12 @@ A single class or array of classes that the value is validated against. (Block) - (defaults to: lambda{|v| true }) + (defaults to: lambda{|arg| true }) — -

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

      +
      +

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

      @@ -238,9 +232,8 @@ Any block that must evaluate to true for the value to be valid — -

      -true if validation succeeds. -

      +
      +

      true if validation succeeds.

      @@ -257,10 +250,9 @@ true if validation succeeds. — -

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

      +
      +

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

      @@ -294,17 +286,16 @@ types or the block passed returns false
      # 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
      -
      +def self.validate(name, types, v, other= lambda{|arg| 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 @@ -315,9 +306,9 @@ types or the block passed returns false
      diff --git a/doc/Axlsx/Default.html b/doc/Axlsx/Default.html index b5f875da..cbba6fdd 100644 --- a/doc/Axlsx/Default.html +++ b/doc/Axlsx/Default.html @@ -6,7 +6,7 @@ Class: Axlsx::Default - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,10 +94,9 @@

      Overview

      -

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

      + +

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

      @@ -129,9 +128,8 @@ based on the content of your package. -

      -ContentType The type of content. -

      +
      +

      The type of content.

      @@ -156,9 +154,8 @@ ContentType The type of content. -

      -The extension of the content type. -

      +
      +

      The extension of the content type.

      @@ -195,9 +192,8 @@ The extension of the content type. -

      -Creates a new Default object. -

      +
      +

      Creates a new Default object.

      @@ -219,9 +215,8 @@ Creates a new Default object. -

      -Serializes the object to xml. -

      +
      +

      Serializes the object to xml.

      @@ -242,9 +237,8 @@ Serializes the object to xml.

      -

      -Creates a new Default object -

      + +

      Creates a new Default object

      @@ -265,9 +259,8 @@ Creates a new Default object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -312,10 +305,9 @@ a customizable set of options — -

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

      +
      +

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

      @@ -328,23 +320,22 @@ specified.
       
       
      -16
       17
       18
       19
       20
      -21
      +21 +22 -
      # 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
      -
      +
      # File 'lib/axlsx/content_type/default.rb', line 17
      +
      +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
      @@ -367,11 +358,8 @@ specified.

      -

      -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 -

      + +

      The type of content.

      @@ -388,14 +376,6 @@ DRAWING_CT are allowed - — -

      -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 -

      -
      -

    @@ -406,17 +386,16 @@ DRAWING_CT are allowed
     
     
    -10
     11
    -12
    +12 +13 -
    # File 'lib/axlsx/content_type/default.rb', line 10
    +      
    # File 'lib/axlsx/content_type/default.rb', line 11
     
    -def ContentType
    -  @ContentType
    -end
    -
    +def ContentType + @ContentType +end
    @@ -434,9 +413,8 @@ DRAWING_CT are allowed

    -

    -The extension of the content type. -

    + +

    The extension of the content type.

    @@ -470,10 +448,9 @@ The extension of the content type.
    # File 'lib/axlsx/content_type/default.rb', line 7
     
    -def Extension
    -  @Extension
    -end
    -
    +def Extension + @Extension +end @@ -495,9 +472,8 @@ The extension of the content type.

    -

    -Serializes the object to xml -

    + +

    Serializes the object to xml

    @@ -516,9 +492,8 @@ Serializes the object to xml — -

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

    +
    +

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

  • @@ -545,17 +520,16 @@ The document builder instance this objects xml will be added to.
     
     
    -28
    -29
    -30
    +33 +34 +35 -
    # File 'lib/axlsx/content_type/default.rb', line 28
    +      
    # File 'lib/axlsx/content_type/default.rb', line 33
     
    -def to_xml(xml)
    -  xml.Default(self.instance_values)
    -end
    -
    +def to_xml(xml) + xml.Default(self.instance_values) +end
    @@ -566,9 +540,9 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/Drawing.html b/doc/Axlsx/Drawing.html index 89318def..80d5ca01 100644 --- a/doc/Axlsx/Drawing.html +++ b/doc/Axlsx/Drawing.html @@ -6,7 +6,7 @@ Class: Axlsx::Drawing - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,19 +97,17 @@
    Note: -

    -The recommended way to manage drawings is to use the Worksheet.add_chart -method. -

    +
    +

    The recommended way to manage drawings is to use the Worksheet.add_chart +method.

    -

    -A Drawing is a canvas for charts. Each worksheet has a single drawing that + +

    A Drawing is a canvas for charts. Each worksheet has a single drawing that manages anchors. The anchors reference the charts via graphical frames. This is not a trivial relationship so please do follow the advice in the -note. see README for an example of how to create a chart. -

    +note. see README for an example of how to create a chart.

    @@ -150,10 +148,9 @@ note. see README for an example of how to create a chart. -

    -A collection of anchors for this drawing only TwoCellAnchors are supported -in this version. -

    +
    +

    A collection of anchors for this drawing only TwoCellAnchors are supported +in this version.

    @@ -162,7 +159,7 @@ in this version.
  • - - (Array) charts + - (Worksheet) worksheet @@ -178,163 +175,152 @@ in this version. -

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

    +
    +

    The worksheet that owns the drawing.

  • -
  • + + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (Object) add_chart(chart_type, options = {}) + - (Relationships) relationships @@ -406,9 +374,8 @@ The worksheet that owns the drawing. -

      -Adds a chart to the drawing. -

      +
      +

      The drawing's relationships.

    • @@ -417,7 +384,7 @@ Adds a chart to the drawing.
    • - - (Object) add_image(options = {}) + - (String) rels_pn @@ -430,9 +397,8 @@ Adds a chart to the drawing. -

      -Adds an image to the chart. -

      +
      +

      The relational part name for this drawing.

    • @@ -441,14 +407,12 @@ Adds an image to the chart.
    • - - (Drawing) initialize(worksheet) + - (String) rId - constructor - @@ -456,9 +420,8 @@ Adds an image to the chart. -

      -Creates a new Drawing object. -

      +
      +

      The relation reference id for this drawing.

    • @@ -480,9 +443,8 @@ Creates a new Drawing object. -

      -Serializes the drawing. -

      +
      +

      Serializes the drawing.

      @@ -503,9 +465,8 @@ Serializes the drawing.

      -

      -Creates a new Drawing object -

      + +

      Creates a new Drawing object

      @@ -524,9 +485,8 @@ Creates a new Drawing object — -

      -The worksheet that owns this drawing -

      +
      +

      The worksheet that owns this drawing

      @@ -540,23 +500,22 @@ The worksheet that owns this drawing
       
       
      -80
      -81
      -82
      -83
      -84
      -85
      +52 +53 +54 +55 +56 +57 -
      # File 'lib/axlsx/drawing/drawing.rb', line 80
      -
      -def initialize(worksheet)
      -  DataTypeValidator.validate "Drawing.worksheet", Worksheet, worksheet
      -  @worksheet = worksheet
      -  @worksheet.workbook.drawings << self
      -  @anchors = SimpleTypedList.new [TwoCellAnchor, OneCellAnchor]
      -end
      -
      +
      # File 'lib/axlsx/drawing/drawing.rb', line 52
      +
      +def initialize(worksheet)
      +  DataTypeValidator.validate "Drawing.worksheet", Worksheet, worksheet
      +  @worksheet = worksheet
      +  @worksheet.workbook.drawings << self
      +  @anchors = SimpleTypedList.new [TwoCellAnchor, OneCellAnchor]
      +end
      @@ -579,10 +538,9 @@ The worksheet that owns this drawing

      -

      -A collection of anchors for this drawing only TwoCellAnchors are supported -in this version -

      + +

      A collection of anchors for this drawing only TwoCellAnchors are supported +in this version

      @@ -616,10 +574,9 @@ in this version
      # File 'lib/axlsx/drawing/drawing.rb', line 48
       
      -def anchors
      -  @anchors
      -end
      -
      +def anchors + @anchors +end @@ -627,19 +584,18 @@ in this version - +
      -

      +

      - - (Array) charts (readonly) + - (Worksheet) worksheet (readonly)

      -

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

      + +

      The worksheet that owns the drawing

      @@ -652,7 +608,7 @@ An array of charts that are associated with this drawing’s anchors
    • - (Array) + (Worksheet) @@ -666,59 +622,61 @@ An array of charts that are associated with this drawing’s anchors
       
       
      -52
      -53
      -54
      -55
      +43 +44 +45 -
      # File 'lib/axlsx/drawing/drawing.rb', line 52
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 43
       
      -def charts
      -  charts = @anchors.select { |a| a.object.is_a?(GraphicFrame) }
      -  charts.map { |a| a.object.chart }
      -end
      -
      +def worksheet + @worksheet +end
    • - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

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

      -

      -An array of image objects that are associated with this drawing’s -anchors -

      + +
      + Note: +
      +

      The recommended way to manage charts is to use Worksheet.add_chart. Please +refer to that method for documentation.

      +
      +
      + + +

      Adds a chart to the drawing.

      -

      Returns:

      -
        - -
      • - - - (Array) - - - -
      • - -
      + +

      See Also:

      +
      @@ -726,59 +684,56 @@ anchors
       
       
      -56
      -57
      -58
      -59
      +70 +71 +72 +73
      -
      # File 'lib/axlsx/drawing/drawing.rb', line 56
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 70
       
      -def images
      -  images = @anchors.select { |a| a.object.is_a?(Pic) }
      -  images.map { |a| a.object }
      -end
      -
      +def add_chart(chart_type, options={}) + TwoCellAnchor.new(self, options) + @anchors.last.add_chart(chart_type, options) +end
      - - -
      -

      +

      - - (Integer) index (readonly) + - (Object) add_image(options = {})

      -

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

      + +
      + Note: +
      +

      The recommended way to manage images is to use Worksheet.add_image. Please +refer to that method for documentation.

      +
      +
      + + +

      Adds an image to the chart

      -

      Returns:

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

      See Also:

      +
      @@ -786,37 +741,34 @@ collection.
       
       
      -60
      -61
      -62
      +62 +63 +64 +65
      -
      # File 'lib/axlsx/drawing/drawing.rb', line 60
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 62
       
      -def index
      -  @worksheet.workbook.drawings.index(self)
      -end
      -
      +def add_image(options={}) + OneCellAnchor.new(self, options) + @anchors.last.object +end
      - - -
      -

      +

      - - (String) pn (readonly) + - (Array) charts

      -

      -The part name for this drawing -

      + +

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

      @@ -829,7 +781,7 @@ The part name for this drawing
    • - (String) + (Array) @@ -843,37 +795,34 @@ The part name for this drawing
       
       
      -68
      -69
      -70
      +77 +78 +79 +80 -
      # File 'lib/axlsx/drawing/drawing.rb', line 68
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 77
       
      -def pn
      -  "#{DRAWING_PN % (index+1)}"
      -end
      -
      +def charts + charts = @anchors.select { |a| a.object.is_a?(GraphicFrame) } + charts.map { |a| a.object.chart } +end
    • - - -
      -

      +

      - - (Relationships) relationships (readonly) + - (Array) images

      -

      -The drawing’s relationships. -

      + +

      An array of image objects that are associated with this drawing's anchors

      @@ -886,7 +835,7 @@ The drawing’s relationships.
    • - (Relationships) + (Array) @@ -900,51 +849,34 @@ The drawing’s relationships.
       
       
      -76
      -77
      -78
      -79
      -80
      -81
      -82
      -83
       84
      -85
      +85 +86 +87 -
      # File 'lib/axlsx/drawing/drawing.rb', line 76
      -
      -def relationships
      -  r = Relationships.new
      -  charts.each do |chart|
      -    r << Relationship.new(CHART_R, "../#{chart.pn}")
      -  end
      -  images.each do |image|
      -    r << Relationship.new(IMAGE_R, "../#{image.pn}")
      -  end
      -  r
      -end
      -
      +
      # File 'lib/axlsx/drawing/drawing.rb', line 84
      +
      +def images
      +  images = @anchors.select { |a| a.object.is_a?(Pic) }
      +  images.map { |a| a.object }
      +end
    • - - -
      -

      +

      - - (String) rels_pn (readonly) + - (Integer) index

      -

      -The relational part name for this drawing -

      + +

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

      @@ -957,7 +889,7 @@ The relational part name for this drawing
    • - (String) + (Integer) @@ -971,37 +903,32 @@ The relational part name for this drawing
       
       
      -72
      -73
      -74
      +91 +92 +93 -
      # File 'lib/axlsx/drawing/drawing.rb', line 72
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 91
       
      -def rels_pn
      -  "#{DRAWING_RELS_PN % (index+1)}"
      -end
      -
      +def index + @worksheet.workbook.drawings.index(self) +end
    • - - -
      -

      +

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

      -

      -The relation reference id for this drawing -

      + +

      The part name for this drawing

      @@ -1028,37 +955,32 @@ The relation reference id for this drawing
       
       
      -64
      -65
      -66
      +103 +104 +105 -
      # File 'lib/axlsx/drawing/drawing.rb', line 64
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 103
       
      -def rId
      -  "rId#{index+1}"
      -end
      -
      +def pn + "#{DRAWING_PN % (index+1)}" +end
      - - -
      -

      +

      - - (Worksheet) worksheet (readonly) + - (Relationships) relationships

      -

      -The worksheet that owns the drawing -

      + +

      The drawing's relationships.

      @@ -1071,7 +993,7 @@ The worksheet that owns the drawing
    • - (Worksheet) + (Relationships) @@ -1085,64 +1007,65 @@ The worksheet that owns the drawing
       
       
      -43
      -44
      -45
      +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 -
      # File 'lib/axlsx/drawing/drawing.rb', line 43
      -
      -def worksheet
      -  @worksheet
      -end
      -
      +
      # File 'lib/axlsx/drawing/drawing.rb', line 115
      +
      +def relationships
      +  r = Relationships.new
      +  charts.each do |chart|
      +    r << Relationship.new(CHART_R, "../#{chart.pn}")
      +  end
      +  images.each do |image|
      +    r << Relationship.new(IMAGE_R, "../#{image.pn}")
      +  end
      +  r
      +end
    • -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

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

      -
      - Note: -

      -The recommended way to manage charts is to use Worksheet.add_chart. Please -refer to that method for documentation. -

      -
      -
      - -

      -Adds a chart to the drawing. -

      +

      The relational part name for this drawing

      - -

      See Also:

      - +

      Returns:

      +
        + +
      • + + + (String) + + + +
      • + +
      @@ -1150,59 +1073,51 @@ Adds a chart to the drawing.
       
       
      -98
      -99
      -100
      -101
      +109 +110 +111
      -
      # File 'lib/axlsx/drawing/drawing.rb', line 98
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 109
       
      -def add_chart(chart_type, options={})
      -  TwoCellAnchor.new(self, options)
      -  @anchors.last.add_chart(chart_type, options)
      -end
      -
      +def rels_pn + "#{DRAWING_RELS_PN % (index+1)}" +end
      -

      +

      - - (Object) add_image(options = {}) + - (String) rId

      -
      - Note: -

      -The recommended way to manage images is to use Worksheet.add_image. Please -refer to that method for documentation. -

      -
      -
      - -

      -Adds an image to the chart -

      +

      The relation reference id for this drawing

      - -

      See Also:

      - +

      Returns:

      +
        + +
      • + + + (String) + + + +
      • + +
      @@ -1210,19 +1125,16 @@ Adds an image to the chart
       
       
      -90
      -91
      -92
      -93
      +97 +98 +99
      -
      # File 'lib/axlsx/drawing/drawing.rb', line 90
      +      
      # File 'lib/axlsx/drawing/drawing.rb', line 97
       
      -def add_image(options={})
      -  OneCellAnchor.new(self, options)
      -  @anchors.last.object
      -end
      -
      +def rId + "rId#{index+1}" +end
      @@ -1237,9 +1149,8 @@ Adds an image to the chart

      -

      -Serializes the drawing -

      + +

      Serializes the drawing

      @@ -1266,27 +1177,26 @@ Serializes the drawing
       
       
      -142
      -143
      -144
      -145
      -146
      -147
      -148
      -149
      +128 +129 +130 +131 +132 +133 +134 +135 -
      # File 'lib/axlsx/drawing/drawing.rb', line 142
      -
      -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
      -
      +
      # File 'lib/axlsx/drawing/drawing.rb', line 128
      +
      +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
      @@ -1297,9 +1207,9 @@ Serializes the drawing
      diff --git a/doc/Axlsx/Fill.html b/doc/Axlsx/Fill.html index fb9d0d63..c7012232 100644 --- a/doc/Axlsx/Fill.html +++ b/doc/Axlsx/Fill.html @@ -6,7 +6,7 @@ Class: Axlsx::Fill - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,17 +97,15 @@
      Note: -

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

      +
      +

      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. -

      + +

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

      @@ -150,9 +148,8 @@ pattern for cells. -

      -The type of fill. -

      +
      +

      The type of fill.

      @@ -189,9 +186,8 @@ The type of fill. -

      -Creates a new Fill object. -

      +
      +

      Creates a new Fill object.

      @@ -213,9 +209,8 @@ Creates a new Fill object. -

      -Serializes the fill. -

      +
      +

      Serializes the fill.

      @@ -236,9 +231,8 @@ Serializes the fill.

      -

      -Creates a new Fill object -

      + +

      Creates a new Fill object

      @@ -271,9 +265,8 @@ Creates a new Fill object — -

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

      +
      +

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

      @@ -293,10 +286,9 @@ if the fill_type parameter is not a PatternFill or a GradientFill instance
      # File 'lib/axlsx/stylesheet/fill.rb', line 16
       
      -def initialize(fill_type)
      -  self.fill_type = fill_type
      -end
      -
      +def initialize(fill_type) + self.fill_type = fill_type +end @@ -319,9 +311,8 @@ if the fill_type parameter is not a PatternFill or a GradientFill instance

      -

      -The type of fill -

      + +

      The type of fill

      @@ -355,10 +346,9 @@ The type of fill
      # File 'lib/axlsx/stylesheet/fill.rb', line 11
       
      -def fill_type
      -  @fill_type
      -end
      -
      +def fill_type + @fill_type +end @@ -380,9 +370,8 @@ The type of fill

      -

      -Serializes the fill -

      + +

      Serializes the fill

      @@ -401,9 +390,8 @@ Serializes the fill — -

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

      +
      +

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

      @@ -437,10 +425,9 @@ The document builder instance this objects xml will be added to.
      # File 'lib/axlsx/stylesheet/fill.rb', line 23
       
      -def to_xml(xml)
      -  xml.fill { @fill_type.to_xml(xml) }
      -end
      -
      +def to_xml(xml) + xml.fill { @fill_type.to_xml(xml) } +end @@ -451,9 +438,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Font.html b/doc/Axlsx/Font.html index 9e635f51..575eb462 100644 --- a/doc/Axlsx/Font.html +++ b/doc/Axlsx/Font.html @@ -6,7 +6,7 @@ Class: Axlsx::Font - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,15 +97,13 @@
      Note: -

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

      +
      +

      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. -

      + +

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

      @@ -144,9 +142,8 @@ The Font class details a font instance for use in styling cells. -

      -Indicates if the font should be rendered in bold. -

      +
      +

      Indicates if the font should be rendered in bold.

      @@ -171,9 +168,8 @@ Indicates if the font should be rendered in bold. -

      -The charset of the font. -

      +
      +

      The charset of the font.

      @@ -198,9 +194,8 @@ The charset of the font. -

      -The color of the font. -

      +
      +

      The color of the font.

      @@ -225,9 +220,8 @@ The color of the font. -

      -Indicates if the font should be condensed. -

      +
      +

      Indicates if the font should be condensed.

      @@ -252,9 +246,8 @@ Indicates if the font should be condensed. -

      -The font’s extend property. -

      +
      +

      The font's extend property.

      @@ -279,9 +272,8 @@ The font’s extend property. -

      -The font’s family. -

      +
      +

      The font's family.

      @@ -306,9 +298,8 @@ The font’s family. -

      -Indicates if the font should be rendered italicized. -

      +
      +

      Indicates if the font should be rendered italicized.

      @@ -333,9 +324,8 @@ Indicates if the font should be rendered italicized. -

      -The name of the font. -

      +
      +

      The name of the font.

      @@ -360,9 +350,8 @@ The name of the font. -

      -Indicates if the font should be rendered with an outline. -

      +
      +

      Indicates if the font should be rendered with an outline.

      @@ -387,9 +376,8 @@ Indicates if the font should be rendered with an outline. -

      -Indicates if the font should be rendered with a shadow. -

      +
      +

      Indicates if the font should be rendered with a shadow.

      @@ -414,9 +402,8 @@ Indicates if the font should be rendered with a shadow. -

      -Indicates if the font should be rendered with a strikthrough. -

      +
      +

      Indicates if the font should be rendered with a strikthrough.

      @@ -441,9 +428,8 @@ Indicates if the font should be rendered with a strikthrough. -

      -The size of the font. -

      +
      +

      The size of the font.

      @@ -480,9 +466,8 @@ The size of the font. -

      -Creates a new Font. -

      +
      +

      Creates a new Font.

      @@ -504,9 +489,8 @@ Creates a new Font. -

      -Serializes the fill. -

      +
      +

      Serializes the fill.

      @@ -527,9 +511,8 @@ Serializes the fill.

      -

      -Creates a new Font -

      + +

      Creates a new Font

      @@ -550,9 +533,8 @@ Creates a new Font — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -701,12 +683,11 @@ a customizable set of options
      # 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
      -
      +def initialize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] + end +end @@ -729,9 +710,8 @@ a customizable set of options

      -

      -Indicates if the font should be rendered in bold -

      + +

      Indicates if the font should be rendered in bold

      @@ -765,10 +745,9 @@ Indicates if the font should be rendered in bold
      # File 'lib/axlsx/stylesheet/font.rb', line 50
       
      -def b
      -  @b
      -end
      -
      +def b + @b +end @@ -789,37 +768,34 @@ Indicates if the font should be rendered in bold
      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 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 -

      + +

      The charset of the font

      @@ -853,10 +829,9 @@ The charset of the font
      # File 'lib/axlsx/stylesheet/font.rb', line 33
       
      -def charset
      -  @charset
      -end
      -
      +def charset + @charset +end @@ -874,9 +849,8 @@ The charset of the font

      -

      -The color of the font -

      + +

      The color of the font

      @@ -910,10 +884,9 @@ The color of the font
      # File 'lib/axlsx/stylesheet/font.rb', line 78
       
      -def color
      -  @color
      -end
      -
      +def color + @color +end @@ -931,9 +904,8 @@ The color of the font

      -

      -Indicates if the font should be condensed -

      + +

      Indicates if the font should be condensed

      @@ -967,10 +939,9 @@ Indicates if the font should be condensed
      # File 'lib/axlsx/stylesheet/font.rb', line 70
       
      -def condense
      -  @condense
      -end
      -
      +def condense + @condense +end @@ -988,9 +959,8 @@ Indicates if the font should be condensed

      -

      -The font’s extend property -

      + +

      The font's extend property

      @@ -1024,10 +994,9 @@ The font’s extend property
      # File 'lib/axlsx/stylesheet/font.rb', line 74
       
      -def extend
      -  @extend
      -end
      -
      +def extend + @extend +end @@ -1048,24 +1017,21 @@ The font’s extend property
      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 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 -

      + +

      The font's family

      @@ -1099,10 +1065,9 @@ The font’s family
      # File 'lib/axlsx/stylesheet/font.rb', line 46
       
      -def family
      -  @family
      -end
      -
      +def family + @family +end @@ -1120,9 +1085,8 @@ The font’s family

      -

      -Indicates if the font should be rendered italicized -

      + +

      Indicates if the font should be rendered italicized

      @@ -1156,10 +1120,9 @@ Indicates if the font should be rendered italicized
      # File 'lib/axlsx/stylesheet/font.rb', line 54
       
      -def i
      -  @i
      -end
      -
      +def i + @i +end @@ -1177,9 +1140,8 @@ Indicates if the font should be rendered italicized

      -

      -The name of the font -

      + +

      The name of the font

      @@ -1213,10 +1175,9 @@ The name of the font
      # File 'lib/axlsx/stylesheet/font.rb', line 8
       
      -def name
      -  @name
      -end
      -
      +def name + @name +end @@ -1234,9 +1195,8 @@ The name of the font

      -

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

      + +

      Indicates if the font should be rendered with an outline

      @@ -1270,10 +1230,9 @@ Indicates if the font should be rendered with an outline
      # File 'lib/axlsx/stylesheet/font.rb', line 62
       
      -def outline
      -  @outline
      -end
      -
      +def outline + @outline +end @@ -1291,9 +1250,8 @@ Indicates if the font should be rendered with an outline

      -

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

      + +

      Indicates if the font should be rendered with a shadow

      @@ -1327,10 +1285,9 @@ Indicates if the font should be rendered with a shadow
      # File 'lib/axlsx/stylesheet/font.rb', line 66
       
      -def shadow
      -  @shadow
      -end
      -
      +def shadow + @shadow +end @@ -1348,9 +1305,8 @@ Indicates if the font should be rendered with a shadow

      -

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

      + +

      Indicates if the font should be rendered with a strikthrough

      @@ -1384,10 +1340,9 @@ Indicates if the font should be rendered with a strikthrough
      # File 'lib/axlsx/stylesheet/font.rb', line 58
       
      -def strike
      -  @strike
      -end
      -
      +def strike + @strike +end @@ -1405,9 +1360,8 @@ Indicates if the font should be rendered with a strikthrough

      -

      -The size of the font. -

      + +

      The size of the font.

      @@ -1441,10 +1395,9 @@ The size of the font.
      # File 'lib/axlsx/stylesheet/font.rb', line 82
       
      -def sz
      -  @sz
      -end
      -
      +def sz + @sz +end @@ -1466,9 +1419,8 @@ The size of the font.

      -

      -Serializes the fill -

      + +

      Serializes the fill

      @@ -1487,9 +1439,8 @@ Serializes the fill — -

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

      +
      +

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

      @@ -1516,25 +1467,24 @@ The document builder instance this objects xml will be added to.
       
       
      -120
      -121
      -122
      -123
      -124
      -125
      -126
      +131 +132 +133 +134 +135 +136 +137 -
      # 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
      -
      +
      # File 'lib/axlsx/stylesheet/font.rb', line 131
      +
      +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
      @@ -1545,9 +1495,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/GradientFill.html b/doc/Axlsx/GradientFill.html index 9013f3c6..893cc360 100644 --- a/doc/Axlsx/GradientFill.html +++ b/doc/Axlsx/GradientFill.html @@ -6,7 +6,7 @@ Class: Axlsx::GradientFill - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

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

      + +

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

      @@ -135,9 +134,8 @@ A GradientFill defines the color and positioning for gradiant cell fill. -

      -Percentage format bottom. -

      +
      +

      Percentage format bottom.

      @@ -162,9 +160,8 @@ Percentage format bottom. -

      -Angle of the linear gradient. -

      +
      +

      Angle of the linear gradient.

      @@ -189,9 +186,8 @@ Angle of the linear gradient. -

      -Percentage format left. -

      +
      +

      Percentage format left.

      @@ -216,9 +212,8 @@ Percentage format left. -

      -Percentage format right. -

      +
      +

      Percentage format right.

      @@ -243,9 +238,8 @@ Percentage format right. -

      -Collection of stop objects. -

      +
      +

      Collection of stop objects.

      @@ -270,9 +264,8 @@ Collection of stop objects. -

      -Percentage format top. -

      +
      +

      Percentage format top.

      @@ -297,9 +290,8 @@ Percentage format top. -

      -The type of gradient. -

      +
      +

      The type of gradient.

      @@ -336,9 +328,8 @@ The type of gradient. -

      -Creates a new GradientFill object. -

      +
      +

      Creates a new GradientFill object.

      @@ -360,9 +351,8 @@ Creates a new GradientFill object. -

      -Serializes the gradientFill. -

      +
      +

      Serializes the gradientFill.

      @@ -383,9 +373,8 @@ Serializes the gradientFill.

      -

      -Creates a new GradientFill object -

      + +

      Creates a new GradientFill object

      @@ -406,9 +395,8 @@ Creates a new GradientFill object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -496,14 +484,13 @@ a customizable set of options
      # 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
      -
      +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 @@ -526,9 +513,8 @@ a customizable set of options

      -

      -Percentage format bottom -

      + +

      Percentage format bottom

      @@ -562,10 +548,9 @@ Percentage format bottom
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 33
       
      -def bottom
      -  @bottom
      -end
      -
      +def bottom + @bottom +end @@ -583,9 +568,8 @@ Percentage format bottom

      -

      -Angle of the linear gradient -

      + +

      Angle of the linear gradient

      @@ -619,10 +603,9 @@ Angle of the linear gradient
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 17
       
      -def degree
      -  @degree
      -end
      -
      +def degree + @degree +end @@ -640,9 +623,8 @@ Angle of the linear gradient

      -

      -Percentage format left -

      + +

      Percentage format left

      @@ -676,10 +658,9 @@ Percentage format left
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 21
       
      -def left
      -  @left
      -end
      -
      +def left + @left +end @@ -697,9 +678,8 @@ Percentage format left

      -

      -Percentage format right -

      + +

      Percentage format right

      @@ -733,10 +713,9 @@ Percentage format right
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 25
       
      -def right
      -  @right
      -end
      -
      +def right + @right +end @@ -754,9 +733,8 @@ Percentage format right

      -

      -Collection of stop objects -

      + +

      Collection of stop objects

      @@ -790,10 +768,9 @@ Collection of stop objects
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 37
       
      -def stop
      -  @stop
      -end
      -
      +def stop + @stop +end @@ -811,9 +788,8 @@ Collection of stop objects

      -

      -Percentage format top -

      + +

      Percentage format top

      @@ -847,10 +823,9 @@ Percentage format top
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 29
       
      -def top
      -  @top
      -end
      -
      +def top + @top +end @@ -871,19 +846,16 @@ Percentage format top
      Note: -

      -valid options are -

      -
      - :linear
      - :path
      -
      +
      +

      valid options are

      + +
      :linear
      +:path
      -

      -The type of gradient. -

      + +

      The type of gradient.

      @@ -917,10 +889,9 @@ The type of gradient.
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 13
       
      -def type
      -  @type
      -end
      -
      +def type + @type +end @@ -942,9 +913,8 @@ The type of gradient.

      -

      -Serializes the gradientFill -

      + +

      Serializes the gradientFill

      @@ -963,9 +933,8 @@ Serializes the gradientFill — -

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

      +
      +

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

      @@ -992,21 +961,20 @@ The document builder instance this objects xml will be added to.
       
       
      -64
      -65
      -66
      -67
      -68
      +70 +71 +72 +73 +74 -
      # 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
      -
      +
      # File 'lib/axlsx/stylesheet/gradient_fill.rb', line 70
      +
      +def to_xml(xml)
      +  xml.gradientFill(self.instance_values.reject { |k,v| k.to_sym == :stop }) {
      +    @stop.each { |s| s.to_xml(xml) }
      +  }
      +end
      @@ -1017,9 +985,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/GradientStop.html b/doc/Axlsx/GradientStop.html index 36c97f81..405b6efd 100644 --- a/doc/Axlsx/GradientStop.html +++ b/doc/Axlsx/GradientStop.html @@ -6,7 +6,7 @@ Class: Axlsx::GradientStop - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

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

      + +

      The GradientStop object represents a color point in a gradient.

      @@ -135,9 +134,8 @@ The GradientStop object represents a color point in a gradient. -

      -The color for this gradient stop. -

      +
      +

      The color for this gradient stop.

      @@ -162,9 +160,8 @@ The color for this gradient stop. -

      -The position of the color. -

      +
      +

      The position of the color.

      @@ -201,9 +198,8 @@ The position of the color. -

      -Creates a new GradientStop object. -

      +
      +

      Creates a new GradientStop object.

      @@ -225,9 +221,8 @@ Creates a new GradientStop object. -

      -Serializes the gradientStop. -

      +
      +

      Serializes the gradientStop.

      @@ -248,9 +243,8 @@ Serializes the gradientStop.

      -

      -Creates a new GradientStop object -

      + +

      Creates a new GradientStop object

      @@ -298,11 +292,10 @@ Creates a new GradientStop object
      # File 'lib/axlsx/stylesheet/gradient_stop.rb', line 18
       
      -def initialize(color, position)
      -  self.color = color
      -  self.position = position
      -end
      -
      +def initialize(color, position) + self.color = color + self.position = position +end @@ -325,9 +318,8 @@ Creates a new GradientStop object

      -

      -The color for this gradient stop -

      + +

      The color for this gradient stop

      @@ -368,10 +360,9 @@ The color for this gradient stop
      # File 'lib/axlsx/stylesheet/gradient_stop.rb', line 9
       
      -def color
      -  @color
      -end
      -
      +def color + @color +end @@ -389,9 +380,8 @@ The color for this gradient stop

      -

      -The position of the color -

      + +

      The position of the color

      @@ -425,10 +415,9 @@ The position of the color
      # File 'lib/axlsx/stylesheet/gradient_stop.rb', line 13
       
      -def position
      -  @position
      -end
      -
      +def position + @position +end @@ -450,9 +439,8 @@ The position of the color

      -

      -Serializes the gradientStop -

      + +

      Serializes the gradientStop

      @@ -471,9 +459,8 @@ Serializes the gradientStop — -

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

      +
      +

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

      @@ -500,13 +487,12 @@ The document builder instance this objects xml will be added to.
       
       
      -29
      +31 -
      # File 'lib/axlsx/stylesheet/gradient_stop.rb', line 29
      +      
      # File 'lib/axlsx/stylesheet/gradient_stop.rb', line 31
       
      -def to_xml(xml) xml.stop(:position => self.position) {self.color.to_xml(xml)} end
      -
      +def to_xml(xml) xml.stop(:position => self.position) {self.color.to_xml(xml)} end
      @@ -517,9 +503,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/GraphicFrame.html b/doc/Axlsx/GraphicFrame.html index a04b2477..39c8949b 100644 --- a/doc/Axlsx/GraphicFrame.html +++ b/doc/Axlsx/GraphicFrame.html @@ -6,7 +6,7 @@ Class: Axlsx::GraphicFrame - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,15 +97,13 @@
      Note: -

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

      +
      +

      The recommended way to manage charts is Worksheet#add_chart

      -

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

      + +

      A graphic frame defines a container for a chart object

      @@ -144,9 +142,8 @@ A graphic frame defines a container for a chart object -

      -A anchor that holds this frame. -

      +
      +

      A anchor that holds this frame.

      @@ -171,26 +168,37 @@ A anchor that holds this frame. -

      -A reference to the chart object associated with this frame. -

      +
      +

      A reference to the chart object associated with this frame.

      -
    • +
    + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (GraphicFrame) initialize(anchor, chart_type, options) + - (String) rId - constructor - @@ -237,9 +229,8 @@ The relationship id for this graphic. -

      -Creates a new GraphicFrame object. -

      +
      +

      The relationship id for this graphic.

    • @@ -261,9 +252,8 @@ Creates a new GraphicFrame object. -

      -Serializes the graphic frame. -

      +
      +

      Serializes the graphic frame.

      @@ -284,9 +274,8 @@ Serializes the graphic frame.

      -

      -Creates a new GraphicFrame object -

      + +

      Creates a new GraphicFrame object

      @@ -326,21 +315,20 @@ Creates a new GraphicFrame object
       
       
      -22
      -23
      -24
      -25
      -26
      +18 +19 +20 +21 +22 -
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 22
      -
      -def initialize(anchor, chart_type, options)
      -  DataTypeValidator.validate "Drawing.chart_type", Chart, chart_type 
      -  @anchor = anchor
      -  @chart = chart_type.new(self, options)
      -end
      -
      +
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 18
      +
      +def initialize(anchor, chart_type, options)
      +  DataTypeValidator.validate "Drawing.chart_type", Chart, chart_type 
      +  @anchor = anchor
      +  @chart = chart_type.new(self, options)
      +end
      @@ -363,9 +351,8 @@ Creates a new GraphicFrame object

      -

      -A anchor that holds this frame -

      + +

      A anchor that holds this frame

      @@ -399,10 +386,9 @@ A anchor that holds this frame
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 13
       
      -def anchor
      -  @anchor
      -end
      -
      +def anchor + @anchor +end @@ -420,9 +406,8 @@ A anchor that holds this frame

      -

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

      + +

      A reference to the chart object associated with this frame

      @@ -456,30 +441,32 @@ A reference to the chart object associated with this frame
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 9
       
      -def chart
      -  @chart
      -end
      -
      +def chart + @chart +end
      - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

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

      -

      -The relationship id for this graphic -

      + +

      The relationship id for this graphic

      @@ -506,31 +493,23 @@ The relationship id for this graphic
       
       
      -17
      -18
      -19
      +26 +27 +28 -
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 17
      +      
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 26
       
      -def rId 
      -  "rId#{@anchor.index+1}"
      -end
      -
      +def rId + "rId#{@anchor.index+1}" +end
      -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

      - (String) to_xml(xml) @@ -538,9 +517,8 @@ The relationship id for this graphic

      -

      -Serializes the graphic frame -

      + +

      Serializes the graphic frame

      @@ -559,9 +537,8 @@ Serializes the graphic frame — -

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

      +
      +

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

      @@ -588,6 +565,8 @@ The document builder instance this objects xml will be added to.
       
       
      +33
      +34
       35
       36
       37
      @@ -603,32 +582,29 @@ The document builder instance this objects xml will be added to.
       47
       48
       49
      -50
      -51
      -52
      +50 -
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 35
      -
      -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
      -
      +
      # File 'lib/axlsx/drawing/graphic_frame.rb', line 33
      +
      +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
      @@ -639,9 +615,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Line3DChart.html b/doc/Axlsx/Line3DChart.html index 2fd3d0b2..cdb85a73 100644 --- a/doc/Axlsx/Line3DChart.html +++ b/doc/Axlsx/Line3DChart.html @@ -6,7 +6,7 @@ Class: Axlsx::Line3DChart - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,10 +96,9 @@

      Overview

      -

      -The Line3DChart is a three dimentional line chart (who would have guessed?) -that you can add to your worksheet. -

      + +

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

      @@ -109,21 +108,19 @@ that you can add to your worksheet.

      Examples:

      -

      -Creating a chart -

      +

      +

      Creating a chart

      -
      # This example creates a line in a single sheet.
      -require "rubygems" # if that is your preferred way to manage gems!
      -require "axlsx"
      +      
      # This example creates a line in a single sheet.
      +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"]
      +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::Line3DChart, :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"]
      -
      +chart = ws.add_chart(Axlsx::Line3DChart, :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"]
      @@ -151,9 +148,8 @@ Creating a chart
      GAP_AMOUNT_PERCENT =
      -

      -validation regex for gap amount percent -

      + +

      validation regex for gap amount percent

      @@ -163,8 +159,7 @@ validation regex for gap amount percent
      -
      /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
      -
      +
      /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
      @@ -196,9 +191,8 @@ validation regex for gap amount percent -

      -the category axis. -

      +
      +

      the category axis.

      @@ -223,10 +217,9 @@ the category axis. -

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

      +
      +

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

      @@ -251,9 +244,8 @@ width. -

      -grouping for a column, line, or area chart. -

      +
      +

      grouping for a column, line, or area chart.

      @@ -278,9 +270,8 @@ grouping for a column, line, or area chart. -

      -the category axis. -

      +
      +

      the category axis.

      @@ -305,9 +296,8 @@ the category axis. -

      -the category axis. -

      +
      +

      the category axis.

      @@ -323,7 +313,7 @@ the category axis.

      Attributes inherited from Chart

      -

      graphic_frame, index, pn, series, series_type, show_legend, style, title, view3D

      +

      graphic_frame, series, series_type, show_legend, style, title, view3D

      @@ -352,9 +342,8 @@ the category axis. -

      -Creates a new line chart object. -

      +
      +

      Creates a new line chart object.

      @@ -376,9 +365,8 @@ Creates a new line chart object. -

      -Serializes the bar chart. -

      +
      +

      Serializes the bar chart.

      @@ -396,7 +384,7 @@ Serializes the bar chart.

      Methods inherited from Chart

      -

      #add_series, #end_at, #from, #start_at, #to

      +

      #add_series, #end_at, #from, #index, #pn, #start_at, #to

      Constructor Details

      @@ -409,9 +397,8 @@ Serializes the bar chart.

      -

      -Creates a new line chart object -

      + +

      Creates a new line chart object

      @@ -430,9 +417,8 @@ Creates a new line chart object — -

      -The workbook that owns this chart. -

      +
      +

      The workbook that owns this chart.

      @@ -449,9 +435,8 @@ The workbook that owns this chart. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -586,24 +571,25 @@ a customizable set of options 69 70 71 -72 +72 +73
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 61
       
      -def initialize(frame, options={})
      -  @grouping = :standard
      -  @catAxId = rand(8 ** 8)
      -  @valAxId = rand(8 ** 8)
      -  @serAxId = rand(8 ** 8)
      -  @catAxis = CatAxis.new(@catAxId, @valAxId)
      -  @valAxis = ValAxis.new(@valAxId, @catAxId)
      -  @serAxis = SerAxis.new(@serAxId, @valAxId)
      -  super(frame, options)      
      -  @series_type = LineSeries
      -  @view3D = View3D.new({:perspective=>30}.merge(options))
      -end
      -
      +def initialize(frame, options={}) + @gapDepth = nil + @grouping = :standard + @catAxId = rand(8 ** 8) + @valAxId = rand(8 ** 8) + @serAxId = rand(8 ** 8) + @catAxis = CatAxis.new(@catAxId, @valAxId) + @valAxis = ValAxis.new(@valAxId, @catAxId) + @serAxis = SerAxis.new(@serAxId, @valAxId) + super(frame, options) + @series_type = LineSeries + @view3D = View3D.new({:perspective=>30}.merge(options)) +end @@ -626,9 +612,8 @@ a customizable set of options

      -

      -the category axis -

      + +

      the category axis

      @@ -662,10 +647,9 @@ the category axis
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 25
       
      -def catAxis
      -  @catAxis
      -end
      -
      +def catAxis + @catAxis +end @@ -683,10 +667,9 @@ the category axis

      -

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

      + +

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

      @@ -720,10 +703,9 @@ width.
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 37
       
      -def gapDepth
      -  @gapDepth
      -end
      -
      +def gapDepth + @gapDepth +end @@ -741,10 +723,9 @@ width.

      -

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

      + +

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

      @@ -778,10 +759,9 @@ grouping for a column, line, or area chart. must be one of
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 42
       
      -def grouping
      -  @grouping
      -end
      -
      +def grouping + @grouping +end @@ -799,9 +779,8 @@ grouping for a column, line, or area chart. must be one of

      -

      -the category axis -

      + +

      the category axis

      @@ -835,10 +814,9 @@ the category axis
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 33
       
      -def serAxis
      -  @serAxis
      -end
      -
      +def serAxis + @serAxis +end @@ -856,9 +834,8 @@ the category axis

      -

      -the category axis -

      + +

      the category axis

      @@ -892,10 +869,9 @@ the category axis
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 29
       
      -def valAxis
      -  @valAxis
      -end
      -
      +def valAxis + @valAxis +end @@ -917,9 +893,8 @@ the category axis

      -

      -Serializes the bar chart -

      + +

      Serializes the bar chart

      @@ -946,9 +921,6 @@ Serializes the bar chart
       
       
      -86
      -87
      -88
       89
       90
       91
      @@ -961,28 +933,30 @@ Serializes the bar chart
       98
       99
       100
      -101
      +101 +102 +103 +104 -
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 86
      -
      -def to_xml
      -  super() do |xml|
      -    xml.send('c:line3DChart') {
      -      xml.send('c:grouping', :val=>grouping)
      -      xml.send('c:varyColors', :val=>1)
      -      @series.each { |ser| ser.to_xml(xml) }
      -      xml.send('c:gapDepth', :val=>@gapDepth) unless @gapDepth.nil?
      -      xml.send('c:axId', :val=>@catAxId)
      -      xml.send('c:axId', :val=>@valAxId)
      -      xml.send('c:axId', :val=>@serAxId)
      -    }
      -    @catAxis.to_xml(xml)
      -    @valAxis.to_xml(xml)
      -    @serAxis.to_xml(xml)
      -  end
      -end
      -
      +
      # File 'lib/axlsx/drawing/line_3D_chart.rb', line 89
      +
      +def to_xml
      +  super() do |xml|
      +    xml.send('c:line3DChart') {
      +      xml.send('c:grouping', :val=>grouping)
      +      xml.send('c:varyColors', :val=>1)
      +      @series.each { |ser| ser.to_xml(xml) }
      +      xml.send('c:gapDepth', :val=>@gapDepth) unless @gapDepth.nil?
      +      xml.send('c:axId', :val=>@catAxId)
      +      xml.send('c:axId', :val=>@valAxId)
      +      xml.send('c:axId', :val=>@serAxId)
      +    }
      +    @catAxis.to_xml(xml)
      +    @valAxis.to_xml(xml)
      +    @serAxis.to_xml(xml)
      +  end
      +end
      @@ -993,9 +967,9 @@ Serializes the bar chart
      diff --git a/doc/Axlsx/LineSeries.html b/doc/Axlsx/LineSeries.html index d5cc8c2c..b2d75a69 100644 --- a/doc/Axlsx/LineSeries.html +++ b/doc/Axlsx/LineSeries.html @@ -6,7 +6,7 @@ Class: Axlsx::LineSeries - — Documentation by YARD 0.7.3 + — AXLSX @@ -99,15 +99,13 @@
      Note: -

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

      +
      +

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

      -

      -A LineSeries defines the title, data and labels for line charts -

      + +

      A LineSeries defines the title, data and labels for line charts

      @@ -152,9 +150,8 @@ A LineSeries defines the title, data and labels for line charts -

      -The data for this series. -

      +
      +

      The data for this series.

      @@ -179,9 +176,8 @@ The data for this series. -

      -The labels for this series. -

      +
      +

      The labels for this series.

      @@ -197,7 +193,7 @@ The labels for this series.

      Attributes inherited from Series

      -

      chart, index, order, title

      +

      chart, title

      @@ -226,9 +222,8 @@ The labels for this series. -

      -Creates a new series. -

      +
      +

      Creates a new series.

      @@ -250,9 +245,8 @@ Creates a new series. -

      -Serializes the series. -

      +
      +

      Serializes the series.

      @@ -266,7 +260,12 @@ Serializes the series. -
      + + + +

      Methods inherited from Series

      +

      #index, #order, #order=

      +

      Constructor Details

      @@ -278,9 +277,8 @@ Serializes the series.

      -

      -Creates a new series -

      + +

      Creates a new series

      @@ -312,9 +310,8 @@ Creates a new series — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -361,17 +358,18 @@ a customizable set of options 21 22 23 -24 +24 +25
      # File 'lib/axlsx/drawing/line_series.rb', line 20
       
      -def initialize(chart, options={})
      -  super(chart, options)
      -  self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
      -  self.data = ValAxisData.new(options[:data]) unless options[:data].nil?
      -end
      -
      +def initialize(chart, options={}) + @labels, @data = nil, nil + super(chart, options) + @labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? + @data = ValAxisData.new(options[:data]) unless options[:data].nil? +end @@ -394,9 +392,8 @@ a customizable set of options

      -

      -The data for this series. -

      + +

      The data for this series.

      @@ -430,10 +427,9 @@ The data for this series.
      # File 'lib/axlsx/drawing/line_series.rb', line 10
       
      -def data
      -  @data
      -end
      -
      +def data + @data +end @@ -451,9 +447,8 @@ The data for this series.

      -

      -The labels for this series. -

      + +

      The labels for this series.

      @@ -487,10 +482,9 @@ The labels for this series.
      # File 'lib/axlsx/drawing/line_series.rb', line 14
       
      -def labels
      -  @labels
      -end
      -
      +def labels + @labels +end @@ -512,9 +506,8 @@ The labels for this series.

      -

      -Serializes the series -

      + +

      Serializes the series

      @@ -533,9 +526,8 @@ Serializes the series — -

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

      +
      +

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

      @@ -562,23 +554,22 @@ The document builder instance this objects xml will be added to.
       
       
      -29
       30
       31
       32
       33
      -34
      +34 +35 -
      # File 'lib/axlsx/drawing/line_series.rb', line 29
      -
      -def to_xml(xml)
      -  super(xml) do |xml|
      -    @labels.to_xml(xml) unless @labels.nil?
      -    @data.to_xml(xml) unless @data.nil?
      -  end      
      -end
      -
      +
      # File 'lib/axlsx/drawing/line_series.rb', line 30
      +
      +def to_xml(xml)
      +  super(xml) do |xml_inner|
      +    @labels.to_xml(xml_inner) unless @labels.nil?
      +    @data.to_xml(xml_inner) unless @data.nil?
      +  end      
      +end
      @@ -589,9 +580,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Marker.html b/doc/Axlsx/Marker.html index 2c3a2fb6..e58b67ed 100644 --- a/doc/Axlsx/Marker.html +++ b/doc/Axlsx/Marker.html @@ -6,7 +6,7 @@ Class: Axlsx::Marker - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,17 +97,15 @@
      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 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. -

      + +

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

      @@ -146,9 +144,8 @@ attach to. -

      -The column this marker anchors to. -

      +
      +

      The column this marker anchors to.

      @@ -173,9 +170,8 @@ The column this marker anchors to. -

      -The offset distance from this marker’s column. -

      +
      +

      The offset distance from this marker's column.

      @@ -200,9 +196,8 @@ The offset distance from this marker’s column. -

      -The row this marker anchors to. -

      +
      +

      The row this marker anchors to.

      @@ -227,9 +222,8 @@ The row this marker anchors to. -

      -The offset distance from this marker’s row. -

      +
      +

      The offset distance from this marker's row.

      @@ -264,9 +258,8 @@ The offset distance from this marker’s row. -

      -shortcut to set the column, row position for this marker. -

      +
      +

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

      @@ -290,9 +283,8 @@ shortcut to set the column, row position for this marker. -

      -Creates a new Marker object. -

      +
      +

      Creates a new Marker object.

      @@ -314,9 +306,8 @@ Creates a new Marker object. -

      -Serializes the marker. -

      +
      +

      Serializes the marker.

      @@ -337,9 +328,8 @@ Serializes the marker.

      -

      -Creates a new Marker object -

      + +

      Creates a new Marker object

      @@ -360,9 +350,8 @@ Creates a new Marker object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -431,13 +420,12 @@ a customizable set of options
      # 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
      -
      +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 @@ -460,9 +448,8 @@ a customizable set of options

      -

      -The column this marker anchors to -

      + +

      The column this marker anchors to

      @@ -496,10 +483,9 @@ The column this marker anchors to
      # File 'lib/axlsx/drawing/marker.rb', line 9
       
      -def col
      -  @col
      -end
      -
      +def col + @col +end @@ -517,9 +503,8 @@ The column this marker anchors to

      -

      -The offset distance from this marker’s column -

      + +

      The offset distance from this marker's column

      @@ -553,10 +538,9 @@ The offset distance from this marker’s column
      # File 'lib/axlsx/drawing/marker.rb', line 13
       
      -def colOff
      -  @colOff
      -end
      -
      +def colOff + @colOff +end @@ -574,9 +558,8 @@ The offset distance from this marker’s column

      -

      -The row this marker anchors to -

      + +

      The row this marker anchors to

      @@ -610,10 +593,9 @@ The row this marker anchors to
      # File 'lib/axlsx/drawing/marker.rb', line 17
       
      -def row
      -  @row
      -end
      -
      +def row + @row +end @@ -631,9 +613,8 @@ The row this marker anchors to

      -

      -The offset distance from this marker’s row -

      + +

      The offset distance from this marker's row

      @@ -667,10 +648,9 @@ The offset distance from this marker’s row
      # File 'lib/axlsx/drawing/marker.rb', line 21
       
      -def rowOff
      -  @rowOff
      -end
      -
      +def rowOff + @rowOff +end @@ -692,9 +672,8 @@ The offset distance from this marker’s row

      -

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

      + +

      shortcut to set the column, row position for this marker

      @@ -713,9 +692,8 @@ shortcut to set the column, row position for this marker — -

      -the column for the marker -

      +
      +

      the column for the marker

      @@ -730,9 +708,8 @@ the column for the marker — -

      -the row of the marker -

      +
      +

      the row of the marker

      @@ -746,19 +723,18 @@ the row of the marker
       
       
      -43
      -44
      -45
      -46
      +47 +48 +49 +50 -
      # File 'lib/axlsx/drawing/marker.rb', line 43
      +      
      # File 'lib/axlsx/drawing/marker.rb', line 47
       
      -def coord(col, row)
      -  self.col = col
      -  self.row = row
      -end
      -
      +def coord(col, row) + self.col = col + self.row = row +end
      @@ -773,9 +749,8 @@ the row of the marker

      -

      -Serializes the marker -

      + +

      Serializes the marker

      @@ -794,9 +769,8 @@ Serializes the marker — -

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

      +
      +

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

      @@ -823,21 +797,20 @@ The document builder instance this objects xml will be added to.
       
       
      -50
      -51
      -52
      -53
      -54
      +54 +55 +56 +57 +58 -
      # 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
      -
      +
      # File 'lib/axlsx/drawing/marker.rb', line 54
      +
      +def to_xml(xml)
      +  [:col, :colOff, :row, :rowOff].each do |k|
      +    xml.send("xdr:#{k.to_s}", self.send(k))
      +  end      
      +end
      @@ -848,9 +821,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/NumFmt.html b/doc/Axlsx/NumFmt.html index e035b3b5..b308d6dc 100644 --- a/doc/Axlsx/NumFmt.html +++ b/doc/Axlsx/NumFmt.html @@ -6,7 +6,7 @@ Class: Axlsx::NumFmt - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
      Note: -

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

      +
      +

      The recommended way to manage styles is Styles#add_style

      -

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

      + +

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

      @@ -138,9 +136,8 @@ cells. -

      -The formatting to use for this number format. -

      +
      +

      The formatting to use for this number format.

      @@ -165,9 +162,8 @@ The formatting to use for this number format. -

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

      +
      +

      An unsinged integer referencing a standard or custom number format.

      @@ -204,9 +200,8 @@ An unsinged integer referencing a standard or custom number format. -

      -A new instance of NumFmt. -

      +
      +

      A new instance of NumFmt.

      @@ -228,10 +223,9 @@ A new instance of NumFmt. -

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

      +
      +

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

      @@ -252,9 +246,8 @@ attributes.

      -

      -A new instance of NumFmt -

      + +

      A new instance of NumFmt

      @@ -279,14 +272,13 @@ A new instance of NumFmt
      # 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
      -
      +def initialize(options={}) + @numFmtId = 0 + @formatCode = "" + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] + end +end @@ -309,9 +301,8 @@ A new instance of NumFmt

      -

      -The formatting to use for this number format. -

      + +

      The formatting to use for this number format.

      @@ -329,9 +320,8 @@ The formatting to use for this number format. — -

      -The formatting to use for this number format. -

      +
      +

      The formatting to use for this number format.

      @@ -358,10 +348,9 @@ The formatting to use for this number format.
      # File 'lib/axlsx/stylesheet/num_fmt.rb', line 44
       
      -def formatCode
      -  @formatCode
      -end
      -
      +def formatCode + @formatCode +end @@ -382,51 +371,48 @@ The formatting to use for this number format.
      Note: -

      -These are the known formats I can dig up. The constant NUM_FMT_PERCENT is +

      +

      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 @
      -
      +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. -

      + +

      An unsinged integer referencing a standard or custom number format.

      @@ -444,9 +430,8 @@ An unsinged integer referencing a standard or custom number format. — -

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

      +
      +

      An unsinged integer referencing a standard or custom number format.

      @@ -473,10 +458,9 @@ An unsinged integer referencing a standard or custom number format.
      # File 'lib/axlsx/stylesheet/num_fmt.rb', line 40
       
      -def numFmtId
      -  @numFmtId
      -end
      -
      +def numFmtId + @numFmtId +end @@ -498,10 +482,9 @@ An unsinged integer referencing a standard or custom number format.

      -

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

      + +

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

      @@ -520,9 +503,8 @@ attributes. — -

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

      +
      +

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

      @@ -536,13 +518,12 @@ The document builder instance this objects xml will be added to.
       
       
      -58
      +60 -
      # File 'lib/axlsx/stylesheet/num_fmt.rb', line 58
      +      
      # File 'lib/axlsx/stylesheet/num_fmt.rb', line 60
       
      -def to_xml(xml) xml.numFmt(self.instance_values) end
      -
      +def to_xml(xml) xml.numFmt(self.instance_values) end
      @@ -553,9 +534,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/OneCellAnchor.html b/doc/Axlsx/OneCellAnchor.html index e9b0d76a..eaec6d92 100644 --- a/doc/Axlsx/OneCellAnchor.html +++ b/doc/Axlsx/OneCellAnchor.html @@ -6,7 +6,7 @@ Class: Axlsx::OneCellAnchor - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
      Note: -

      -The recommended way to manage drawings, images and charts is -Worksheet#add_chart or Worksheet#add_image. -

      +
      +

      The recommended way to manage drawings, images and charts is +Worksheet#add_chart or Worksheet#add_image.

      -

      -This class details a single cell anchor for drawings. -

      + +

      This class details a single cell anchor for drawings.

      @@ -147,9 +145,8 @@ This class details a single cell anchor for drawings. -

      -The drawing that holds this anchor. -

      +
      +

      The drawing that holds this anchor.

      @@ -174,9 +171,8 @@ The drawing that holds this anchor. -

      -A marker that defines the from cell anchor. -

      +
      +

      A marker that defines the from cell anchor.

      @@ -201,10 +197,9 @@ A marker that defines the from cell anchor. -

      -the height of the graphic object in pixels this is converted to EMU at a 92 -ppi resolution. -

      +
      +

      the height of the graphic object in pixels this is converted to EMU at a 92 +ppi resolution.

      @@ -213,7 +208,7 @@ ppi resolution.
    • - - (Integer) index + - (Pic) object @@ -229,9 +224,8 @@ ppi resolution. -

      -The index of this anchor in the drawing. -

      +
      +

      The object this anchor hosts.

    • @@ -240,14 +234,14 @@ The index of this anchor in the drawing.
    • - - (Pic) object + - (Integer) width - readonly + @@ -256,53 +250,48 @@ The index of this anchor in the drawing. -

      -The object this anchor hosts. -

      +
      +

      the width of the graphic object in pixels.

    • -
    • +
    + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • @@ -322,9 +311,8 @@ the width of the graphic object in pixels. -

      -Creates a new OneCellAnchor object and an Pic associated with it. -

      +
      +

      Creates a new OneCellAnchor object and an Pic associated with it.

    • @@ -346,9 +334,8 @@ Creates a new OneCellAnchor object and an Pic associated with it. -

      -Serializes the anchor. -

      +
      +

      Serializes the anchor.

      @@ -369,9 +356,8 @@ Serializes the anchor.

      -

      -Creates a new OneCellAnchor object and an Pic associated with it. -

      + +

      Creates a new OneCellAnchor object and an Pic associated with it.

      @@ -403,9 +389,8 @@ Creates a new OneCellAnchor object and an Pic associated with it. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -426,9 +411,8 @@ a customizable set of options - —

      -the col, row to start at -

      + —
      +

      the col, row to start at

      @@ -456,9 +440,8 @@ the col, row to start at - —

      -the file location of the image you will render -

      + —
      +

      the file location of the image you will render

      @@ -468,9 +451,8 @@ the file location of the image you will render - —

      -the name attribute for the rendered image -

      + —
      +

      the name attribute for the rendered image

      @@ -480,9 +462,8 @@ the name attribute for the rendered image - —

      -the description of the image rendered -

      + —
      +

      the description of the image rendered

      @@ -496,33 +477,32 @@ the description of the image rendered
       
       
      +39
      +40
      +41
      +42
      +43
       44
       45
       46
       47
       48
      -49
      -50
      -51
      -52
      -53
      -54
      +49 -
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 44
      -
      -def initialize(drawing, options={})
      -  @drawing = drawing
      -  @width = 0
      -  @height = 0
      -  drawing.anchors << self      
      -  @from = Marker.new
      -  options.each do |o|
      -    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      -  end
      -  @object = Pic.new(self, options)
      -end
      -
      +
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 39
      +
      +def initialize(drawing, options={})
      +  @drawing = drawing
      +  @width = 0
      +  @height = 0
      +  drawing.anchors << self      
      +  @from = Marker.new
      +  options.each do |o|
      +    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      +  end
      +  @object = Pic.new(self, options)
      +end
      @@ -545,9 +525,8 @@ the description of the image rendered

      -

      -The drawing that holds this anchor -

      + +

      The drawing that holds this anchor

      @@ -581,10 +560,9 @@ The drawing that holds this anchor
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 18
       
      -def drawing
      -  @drawing
      -end
      -
      +def drawing + @drawing +end @@ -602,10 +580,9 @@ The drawing that holds this anchor

      -

      -A marker that defines the from cell anchor. The default from column and row -are 0 and 0 respectively -

      + +

      A marker that defines the from cell anchor. The default from column and row +are 0 and 0 respectively

      @@ -639,10 +616,9 @@ are 0 and 0 respectively
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 10
       
      -def from
      -  @from
      -end
      -
      +def from + @from +end @@ -660,10 +636,9 @@ are 0 and 0 respectively

      -

      -the height of the graphic object in pixels this is converted to EMU at a 92 -ppi resolution -

      + +

      the height of the graphic object in pixels this is converted to EMU at a 92 +ppi resolution

      @@ -690,17 +665,16 @@ ppi resolution
       
       
      -33
      -34
      -35
      +28 +29 +30 -
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 33
      +      
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 28
       
      -def height
      -  @height
      -end
      -
      +def height + @height +end
      @@ -708,19 +682,18 @@ ppi resolution - +
      -

      +

      - - (Integer) index (readonly) + - (Pic) object (readonly)

      -

      -The index of this anchor in the drawing -

      + +

      The object this anchor hosts

      @@ -733,7 +706,7 @@ The index of this anchor in the drawing
    • - (Integer) + (Pic) @@ -747,37 +720,36 @@ The index of this anchor in the drawing
       
       
      -22
      -23
      -24
      +14 +15 +16 -
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 22
      +      
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 14
       
      -def index
      -  @drawing.anchors.index(self)
      -end
      -
      +def object + @object +end
    • - - + +
      -

      +

      - - (Pic) object (readonly) + - (Integer) width

      -

      -The object this anchor hosts -

      + +

      the width of the graphic object in pixels. this is converted to EMU at a 92 +ppi resolution

      @@ -790,7 +762,7 @@ The object this anchor hosts
    • - (Pic) + (Integer) @@ -804,38 +776,39 @@ The object this anchor hosts
       
       
      -14
      -15
      -16
      +23 +24 +25 -
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 14
      +      
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 23
       
      -def object
      -  @object
      -end
      -
      +def width + @width +end
    • - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

      - - (Integer) width + - (Integer) index

      -

      -the width of the graphic object in pixels. this is converted to EMU at a 92 -ppi resolution -

      + +

      The index of this anchor in the drawing

      @@ -862,31 +835,23 @@ ppi resolution
       
       
      -28
      -29
      -30
      +59 +60 +61 -
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 28
      +      
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 59
       
      -def width
      -  @width
      -end
      -
      +def index + @drawing.anchors.index(self) +end
      -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

      - (String) to_xml(xml) @@ -894,9 +859,8 @@ ppi resolution

      -

      -Serializes the anchor -

      + +

      Serializes the anchor

      @@ -915,9 +879,8 @@ Serializes the anchor — -

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

      +
      +

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

      @@ -958,17 +921,16 @@ The document builder instance this objects xml will be added to.
      # File 'lib/axlsx/drawing/one_cell_anchor.rb', line 66
       
      -def to_xml(xml)
      -  xml.send('xdr:oneCellAnchor') {
      -    xml.send('xdr:from') {
      -      from.to_xml(xml)
      -    }
      -    xml.send('xdr:ext', ext)
      -    @object.to_xml(xml)
      -    xml.send('xdr:clientData')
      -  }
      -end
      -
      +def to_xml(xml) + xml.send('xdr:oneCellAnchor') { + xml.send('xdr:from') { + from.to_xml(xml) + } + xml.send('xdr:ext', ext) + @object.to_xml(xml) + xml.send('xdr:clientData') + } +end @@ -979,9 +941,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Override.html b/doc/Axlsx/Override.html index 78fca49c..542e1ad5 100644 --- a/doc/Axlsx/Override.html +++ b/doc/Axlsx/Override.html @@ -6,7 +6,7 @@ Class: Axlsx::Override - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,10 +94,9 @@

      Overview

      -

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

      + +

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

      @@ -129,9 +128,8 @@ based on the content of your package. -

      -ContentType The type of content. -

      +
      +

      The type of content.

      @@ -156,9 +154,8 @@ ContentType The type of content. -

      -PartName The name and location of the part. -

      +
      +

      The name and location of the part.

      @@ -195,9 +192,8 @@ PartName The name and location of the part. -

      -Creates a new Override object. -

      +
      +

      Creates a new Override object.

      @@ -219,9 +215,8 @@ Creates a new Override object. -

      -Serializes the Override object to xml. -

      +
      +

      Serializes the Override object to xml.

      @@ -242,9 +237,8 @@ Serializes the Override object to xml.

      -

      -Creates a new Override object -

      + +

      Creates a new Override object

      @@ -265,9 +259,8 @@ Creates a new Override object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -312,10 +305,9 @@ a customizable set of options — -

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

      +
      +

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

      @@ -328,23 +320,22 @@ specified.
       
       
      -15
      -16
       17
       18
       19
      -20
      +20 +21 +22 -
      # 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
      -
      +
      # File 'lib/axlsx/content_type/override.rb', line 17
      +
      +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
      @@ -367,11 +358,8 @@ specified.

      -

      -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 -

      + +

      The type of content.

      @@ -388,14 +376,6 @@ DRAWING_CT are allowed - — -

      -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 -

      -
      -
    @@ -406,17 +386,16 @@ DRAWING_CT are allowed
     
     
    -6
     7
    -8
    +8 +9 -
    # File 'lib/axlsx/content_type/override.rb', line 6
    +      
    # File 'lib/axlsx/content_type/override.rb', line 7
     
    -def ContentType
    -  @ContentType
    -end
    -
    +def ContentType + @ContentType +end
    @@ -434,9 +413,8 @@ DRAWING_CT are allowed

    -

    -PartName The name and location of the part. -

    + +

    The name and location of the part.

    @@ -453,12 +431,6 @@ PartName The name and location of the part. - — -

    -PartName The name and location of the part. -

    -
    -
  • @@ -469,17 +441,16 @@ PartName The name and location of the part.
     
     
    -9
    -10
    -11
    +11 +12 +13 -
    # File 'lib/axlsx/content_type/override.rb', line 9
    +      
    # File 'lib/axlsx/content_type/override.rb', line 11
     
    -def PartName
    -  @PartName
    -end
    -
    +def PartName + @PartName +end
    @@ -501,9 +472,8 @@ PartName The name and location of the part.

    -

    -Serializes the Override object to xml -

    + +

    Serializes the Override object to xml

    @@ -522,9 +492,8 @@ Serializes the Override object to xml — -

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

    +
    +

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

    @@ -538,17 +507,16 @@ The document builder instance this objects xml will be added to.
     
     
    -26
    -27
    -28
    +33 +34 +35 -
    # File 'lib/axlsx/content_type/override.rb', line 26
    +      
    # File 'lib/axlsx/content_type/override.rb', line 33
     
    -def to_xml(xml)
    -  xml.Override(self.instance_values)
    -end
    -
    +def to_xml(xml) + xml.Override(self.instance_values) +end
    @@ -559,9 +527,9 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/Package.html b/doc/Axlsx/Package.html index bb9468bd..6ab5ca37 100644 --- a/doc/Axlsx/Package.html +++ b/doc/Axlsx/Package.html @@ -6,7 +6,7 @@ Class: Axlsx::Package - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,11 +94,10 @@

    Overview

    -

    -Package is responsible for managing all the bits and peices that Open + +

    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. -

    +serialization.

    @@ -108,38 +107,6 @@ serialization.
    -

    Instance Attribute Summary (collapse)

    -
      - -
    • - - - - (Workbook) workbook - - - - - - - - - - - - - - - -

      -The workbook this package will serialize or validate. -

      -
      - -
    • - - -
    - @@ -154,55 +121,6 @@ The workbook this package will serialize or validate.
  • - - (ContentType) base_content_types - - - - - - - - - - - - -

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

    -
    - -
  • - - -
  • - - - - (ContentType) content_types - - - - - - - - - - - - -

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

    -
    - -
  • - - -
  • - - - (Package) initialize(options = {}) {|_self| ... } @@ -218,33 +136,8 @@ your workbook to the default content types. -

    -Initializes your package. -

    -
    - -
  • - - -
  • - - - - (Array) parts - - - - - - - - - - - - -

    -The parts of a package. -

    +
    +

    Initializes your package.

  • @@ -253,7 +146,7 @@ The parts of a package.
  • - - (Relationships) relationships + - (Boolean) serialize(output, confirm_valid = false) @@ -266,9 +159,8 @@ The parts of a package. -

    -Creates the relationships required for a valid xlsx document. -

    +
    +

    Serialize your workbook to disk as an xlsx document.

  • @@ -277,7 +169,7 @@ Creates the relationships required for a valid xlsx document.
  • - - (Boolean) serialize(output, confirm_valid = false) + - (Array) validate @@ -290,9 +182,8 @@ Creates the relationships required for a valid xlsx document. -

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

    +
    +

    Validate all parts of the package against xsd schema.

  • @@ -301,7 +192,7 @@ Serialize your workbook to disk as an xlsx document.
  • - - (Array) validate + - (Workbook) workbook @@ -314,9 +205,8 @@ Serialize your workbook to disk as an xlsx document. -

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

    +
    +

    The workbook this package will serialize or validate.

  • @@ -325,7 +215,7 @@ Validate all parts of the package against xsd schema.
  • - - (Array) validate_single_doc(schema, doc) + - (Object) workbook=(workbook) @@ -338,10 +228,7 @@ Validate all parts of the package against xsd schema. -

    -Performs xsd validation for a signle document. -

    -
    +
  • @@ -361,9 +248,8 @@ Performs xsd validation for a signle document.

    -

    -Initializes your package -

    + +

    Initializes your package

    @@ -373,12 +259,10 @@ Initializes your package

    Examples:

    -

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

    +

    +

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

    -
    -
    +
    
         
       

    Parameters:

    @@ -396,10 +280,9 @@ Package.new :author => ‘you!’, :workbook => Workbook.new — -

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

    +
    +

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

    @@ -418,9 +301,8 @@ package. - —

    -The author of the document -

    + —
    +

    The author of the document

    @@ -453,9 +335,8 @@ The author of the document — -

    -the object that the method was called on -

    +
    +

    the object that the method was called on

    @@ -468,21 +349,22 @@ the object that the method was called on
     
     
    -28
    -29
    -30
    -31
    -32
    +12 +13 +14 +15 +16 +17 -
    # 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
    -
    +
    # File 'lib/axlsx/package.rb', line 12
    +
    +def initialize(options={})
    +  @workbook = nil
    +  @core, @app = Core.new, App.new
    +  @core.creator = options[:author] || @core.creator
    +  yield self if block_given?
    +end
    @@ -490,470 +372,13 @@ the object that the method was called on
    -
    -

    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:

    - - -
    - - - - -
    -
    -
    -
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -
    -
    # File 'lib/axlsx/package.rb', line 182
    -
    -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:

    - - -
    - - - - -
    -
    -
    -
    -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
    -
    -
    # File 'lib/axlsx/package.rb', line 151
    -
    -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
    -  exts = workbook.images.map { |image| image.extname }
    -  exts.uniq.each do |ext|
    -    ct = if  ['jpeg', 'jpg'].include?(ext)
    -           JPEG_CT
    -         elsif ext == 'gif'
    -           GIF_CT
    -         elsif ext == 'png'
    -           PNG_CT
    -         end
    -    c_types << Axlsx::Default.new(:ContentType => ct, :Extension => ext )
    -  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. -

      -
      - -
    • - -
    - -
    - - - - -
    -
    -
    -
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -
    -
    # File 'lib/axlsx/package.rb', line 101
    -
    -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.images.each do |image|
    -    @parts << {:entry => "xl/#{image.pn}", :path => image.image_src}
    -  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:

    - - -
    - - - - -
    -
    -
    -
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -
    -
    # File 'lib/axlsx/package.rb', line 197
    -
    -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) @@ -964,17 +389,15 @@ Creates the relationships required for a valid xlsx document

    Note: -

    -A tremendous amount of effort has gone into ensuring that you cannot create +

    +

    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. -

    +you cannot open the serialized file.

    -

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

    + +

    Serialize your workbook to disk as an xlsx document.

    @@ -985,13 +408,12 @@ 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)
    +      
    # 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
    -
    +# You will find a file called test.xlsx

    Parameters:

    @@ -1007,9 +429,8 @@ Serialize your workbook to disk as an xlsx document. — -

    -The file you want to serialize your package to -

    +
    +

    The file you want to serialize your package to

    @@ -1026,9 +447,8 @@ The file you want to serialize your package to — -

    -Validate the package prior to serialization. -

    +
    +

    Validate the package prior to serialization.

    @@ -1046,10 +466,9 @@ Validate the package prior to serialization. — -

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

    +
    +

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

    @@ -1069,6 +488,7 @@ serialized
     
     
    +54
     55
     56
     57
    @@ -1085,33 +505,29 @@ serialized
     68
     69
     70
    -71
    -72
    -73
    +71 -
    # File 'lib/axlsx/package.rb', line 55
    -
    -def serialize(output, confirm_valid=false)
    -  return false unless !confirm_valid || self.validate.empty?
    -  p = parts
    -  Zip::ZipOutputStream.open(output) do |zip|
    -    p.each do |part| 
    -      zip.put_next_entry(part[:entry]); zip.puts(part[:doc]) unless part[:doc].nil?
    -    end
    -  end
    -  Zip::ZipFile.open(output) do |zip|
    -    p.each do |part|
    -      if part[:path]
    -        zip.add(part[:entry], part[:path], &proc{ true })
    -      end
    -    end                  
    -  end
    -
    -
    -  true
    -end
    -
    +
    # File 'lib/axlsx/package.rb', line 54
    +
    +def serialize(output, confirm_valid=false)
    +  return false unless !confirm_valid || self.validate.empty?
    +  p = parts
    +  Zip::ZipOutputStream.open(output) do |zip|
    +    p.each do |part| 
    +      unless part[:doc].nil?
    +        zip.put_next_entry(part[:entry]); 
    +        zip.puts(part[:doc])
    +      end
    +      unless part[:path].nil?
    +        zip.put_next_entry(part[:entry]); 
    +        # binread for 1.9.3
    +        zip.write IO.respond_to?(:binread) ? IO.binread(part[:path]) : IO.read(part[:path])
    +      end          
    +    end
    +  end
    +  true
    +end
    @@ -1129,25 +545,22 @@ serialized
    Note: -

    -This gem includes all schema from OfficeOpenXML-XMLSchema-Transitional.zip +

    +

    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 +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. -

    +improved. Please report your errors to the gem author.

    -

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

    + +

    Validate all parts of the package against xsd schema.

    @@ -1158,11 +571,10 @@ 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 }
    -
    +
    # 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 }
    @@ -1177,9 +589,8 @@ Validate all parts of the package against xsd schema. — -

    -An array of all validation errors found. -

    +
    +

    An array of all validation errors found.

    @@ -1199,101 +610,140 @@ An array of all validation errors found.
     
     
    +88
    +89
     90
     91
    -92
    -93
    -94
    +92 -
    # File 'lib/axlsx/package.rb', line 90
    -
    -def validate
    -  errors = []
    -  parts.each { |part| errors.concat validate_single_doc(part[:schema], part[:doc]) unless part[:schema].nil? }
    -  errors
    -end
    -
    +
    # File 'lib/axlsx/package.rb', line 88
    +
    +def validate
    +  errors = []
    +  parts.each { |part| errors.concat validate_single_doc(part[:schema], part[:doc]) unless part[:schema].nil? }
    +  errors
    +end
    -

    +

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

    -

    -Performs xsd validation for a signle document -

    + +
    + 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.

    -

    Parameters:

    -
      + +

      Returns:

      +
      • - schema - - (String) + (Workbook) — -

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

        +
        +

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

      • +
      +

      Raises:

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

        -The xml text to be validated -

        + +
        +

        ArgumentError if workbook parameter is not a Workbook instance.

      -

      Returns:

      -
        +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +
    +
    # File 'lib/axlsx/package.rb', line 32
    +
    +def workbook
    +  @workbook || @workbook = Workbook.new
    +end
    +
    +
    + +
    +

    -

  • - - - (Array) - - - - — -

    -An array of all validation errors encountered. -

    + - (Object) workbook=(workbook) + + + +

    +
    + + +
    - -
  • +
    - + +

    See Also:

    +
      + +
    • workbook
    • + +
    @@ -1301,31 +751,12 @@ An array of all validation errors encountered.
     
     
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    +37
    -
    # File 'lib/axlsx/package.rb', line 137
    -
    -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
    -
    +
    # File 'lib/axlsx/package.rb', line 37
    +
    +def workbook=(workbook) DataTypeValidator.validate "Package.workbook", Workbook, workbook; @workbook = workbook; end
    @@ -1336,9 +767,9 @@ An array of all validation errors encountered.
    diff --git a/doc/Axlsx/PatternFill.html b/doc/Axlsx/PatternFill.html index 3565ee12..c49ced12 100644 --- a/doc/Axlsx/PatternFill.html +++ b/doc/Axlsx/PatternFill.html @@ -6,7 +6,7 @@ Class: Axlsx::PatternFill - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,15 +97,13 @@
    Note: -

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

    +
    +

    The recommended way to manage styles is with Styles#add_style

    -

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

    + +

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

    @@ -144,9 +142,8 @@ A PatternFill is the pattern and solid fill styling for a cell. -

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

    +
    +

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

    @@ -171,9 +168,8 @@ The color to use for the background of the fill when the type is not solid. -

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

    +
    +

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

    @@ -198,9 +194,8 @@ The color to use for the the background in solid fills. -

    -The pattern type to use. -

    +
    +

    The pattern type to use.

    @@ -237,9 +232,8 @@ The pattern type to use. -

    -Creates a new PatternFill Object. -

    +
    +

    Creates a new PatternFill Object.

    @@ -261,9 +255,8 @@ Creates a new PatternFill Object. -

    -Serializes the pattern fill. -

    +
    +

    Serializes the pattern fill.

    @@ -284,9 +277,8 @@ Serializes the pattern fill.

    -

    -Creates a new PatternFill Object -

    + +

    Creates a new PatternFill Object

    @@ -307,9 +299,8 @@ Creates a new PatternFill Object — -

    -a customizable set of options -

    +
    +

    a customizable set of options

    @@ -369,13 +360,12 @@ a customizable set of options
    # 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
    -
    +def initialize(options={}) + @patternType = :none + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -398,9 +388,8 @@ a customizable set of options

    -

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

    + +

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

    @@ -434,10 +423,9 @@ The color to use for the background of the fill when the type is not solid.
    # File 'lib/axlsx/stylesheet/pattern_fill.rb', line 13
     
    -def bgColor
    -  @bgColor
    -end
    -
    +def bgColor + @bgColor +end @@ -455,9 +443,8 @@ The color to use for the background of the fill when the type is not solid.

    -

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

    + +

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

    @@ -491,10 +478,9 @@ The color to use for the the background in solid fills.
    # File 'lib/axlsx/stylesheet/pattern_fill.rb', line 9
     
    -def fgColor
    -  @fgColor
    -end
    -
    +def fgColor + @fgColor +end @@ -515,36 +501,33 @@ The color to use for the the background in solid fills.
    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
    -
    +
    +

    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 -

    + +

    The pattern type to use

    @@ -572,10 +555,9 @@ The pattern type to use
    # File 'lib/axlsx/stylesheet/pattern_fill.rb', line 38
     
    -def patternType
    -  @patternType
    -end
    -
    +def patternType + @patternType +end @@ -597,9 +579,8 @@ The pattern type to use

    -

    -Serializes the pattern fill -

    + +

    Serializes the pattern fill

    @@ -618,9 +599,8 @@ Serializes the pattern fill — -

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

    +
    +

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

    @@ -647,21 +627,20 @@ The document builder instance this objects xml will be added to.
     
     
    -58
    -59
     60
     61
    -62
    +62 +63 +64 -
    # 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
    -
    +
    # File 'lib/axlsx/stylesheet/pattern_fill.rb', line 60
    +
    +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
    @@ -672,9 +651,9 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/Pic.html b/doc/Axlsx/Pic.html index 6b078a26..c18b3682 100644 --- a/doc/Axlsx/Pic.html +++ b/doc/Axlsx/Pic.html @@ -6,7 +6,7 @@ Class: Axlsx::Pic - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,10 +94,9 @@

    Overview

    -

    -a Pic object represents an image in your worksheet Worksheet#add_image is -the recommended way to manage images in your sheets -

    + +

    a Pic object represents an image in your worksheet Worksheet#add_image is +the recommended way to manage images in your sheets

    @@ -120,9 +119,8 @@ the recommended way to manage images in your sheets
    ALLOWED_EXTENSIONS =
    -

    -allowed file extenstions -

    + +

    allowed file extenstions

    @@ -132,8 +130,7 @@ allowed file extenstions
    -
    ['gif', 'jpeg', 'png', 'jpg']
    -
    +
    ['gif', 'jpeg', 'png', 'jpg']
    @@ -161,9 +158,8 @@ allowed file extenstions -

    -The anchor for this image. -

    +
    +

    The anchor for this image.

    @@ -188,9 +184,8 @@ The anchor for this image. -

    -A description of the picture. -

    +
    +

    A description of the picture.

    @@ -199,14 +194,14 @@ A description of the picture.
  • - - (String) extname + - (String) image_src - readonly + @@ -215,9 +210,9 @@ A description of the picture. -

    -returns the extension of image_src without the preceeding ’.’. -

    +
    +

    The path to the image you want to include Only local images are supported +at this time and only jpg support.

  • @@ -226,14 +221,14 @@ returns the extension of image_src without the preceeding ’.’.
  • - - (String) file_name + - (String) name - readonly + @@ -242,108 +237,125 @@ returns the extension of image_src without the preceeding ’.’. -

    -The name of the image file, sans directory info. -

    +
    +

    The name to use for this picture.

  • -
  • + + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - + + + + + + + + -

    - Instance Method Summary - (collapse) -

    +
    +

    This is a short cut method to set the start anchor position If you need +finer granularity in positioning use graphic_frame.anchor.from.colOff / +rowOff.

    +
    + +
  • -
    • - - (Pic) initialize(anchor, options = {}) {|_self| ... } + - (String) to_xml(xml) - constructor - @@ -445,9 +460,8 @@ providing access to the anchor’s width attribute. -

      -Creates a new Pic(ture) object. -

      +
      +

      Serializes the picture.

    • @@ -456,7 +470,7 @@ Creates a new Pic(ture) object.
    • - - (Marker) start_at(x, y) + - (Object) width @@ -469,11 +483,8 @@ Creates a new Pic(ture) object. -

      -This is a short cut method to set the start anchor position If you need -finer granularity in positioning use graphic_frame.anchor.from.colOff / -rowOff. -

      +
      +

      providing access to the anchor's width attribute.

    • @@ -482,7 +493,7 @@ rowOff.
    • - - (String) to_xml(xml) + - (Object) width=(v) @@ -495,10 +506,7 @@ rowOff. -

      -Serializes the picture. -

      -
      +
    • @@ -518,9 +526,8 @@ Serializes the picture.

      -

      -Creates a new Pic(ture) object -

      + +

      Creates a new Pic(ture) object

      @@ -539,9 +546,8 @@ Creates a new Pic(ture) object — -

      -the anchor that holds this image -

      +
      +

      the anchor that holds this image

      @@ -558,9 +564,8 @@ the anchor that holds this image — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -658,9 +663,8 @@ a customizable set of options — -

      -the object that the method was called on -

      +
      +

      the object that the method was called on

      @@ -673,29 +677,28 @@ the object that the method was called on
       
       
      -66
      -67
      -68
      -69
      -70
      -71
      -72
      -73
      -74
      +38 +39 +40 +41 +42 +43 +44 +45 +46 -
      # File 'lib/axlsx/drawing/pic.rb', line 66
      -
      -def initialize(anchor, options={})
      -  @anchor = anchor
      -  @anchor.drawing.worksheet.workbook.images << self
      -  options.each do |o|
      -    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      -  end
      -  start_at *options[:start_at] if options[:start_at]
      -  yield self if block_given?
      -end
      -
      +
      # File 'lib/axlsx/drawing/pic.rb', line 38
      +
      +def initialize(anchor, options={})
      +  @anchor = anchor
      +  @anchor.drawing.worksheet.workbook.images << self
      +  options.each do |o|
      +    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      +  end
      +  start_at(*options[:start_at]) if options[:start_at]
      +  yield self if block_given?
      +end
      @@ -718,9 +721,8 @@ the object that the method was called on

      -

      -The anchor for this image -

      + +

      The anchor for this image

      @@ -747,17 +749,16 @@ The anchor for this image
       
       
      -36
      -37
      -38
      +27 +28 +29 -
      # File 'lib/axlsx/drawing/pic.rb', line 36
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 27
       
      -def anchor
      -  @anchor
      -end
      -
      +def anchor + @anchor +end
      @@ -775,9 +776,8 @@ The anchor for this image

      -

      -A description of the picture -

      + +

      A description of the picture

      @@ -804,37 +804,36 @@ A description of the picture
       
       
      -27
      -28
      -29
      +18 +19 +20 -
      # File 'lib/axlsx/drawing/pic.rb', line 27
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 18
       
      -def descr
      -  @descr
      -end
      -
      +def descr + @descr +end
      - - + +
      -

      +

      - - (String) extname (readonly) + - (String) image_src

      -

      -returns the extension of image_src without the preceeding ’.’ -

      + +

      The path to the image you want to include Only local images are supported +at this time and only jpg support

      @@ -861,37 +860,35 @@ returns the extension of image_src without the preceeding ’.’
       
       
      -40
      -41
      -42
      +23 +24 +25 -
      # File 'lib/axlsx/drawing/pic.rb', line 40
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 23
       
      -def extname
      -  File.extname(image_src).delete('.') unless image_src.nil?
      -end
      -
      +def image_src + @image_src +end
      - - + +
      -

      +

      - - (String) file_name (readonly) + - (String) name

      -

      -The name of the image file, sans directory info -

      + +

      The name to use for this picture

      @@ -918,51 +915,52 @@ The name of the image file, sans directory info
       
       
      -44
      -45
      -46
      +13 +14 +15 -
      # File 'lib/axlsx/drawing/pic.rb', line 44
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 13
       
      -def file_name
      -  File.basename(image_src) unless image_src.nil?
      -end
      -
      +def name + @name +end
      - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

      - - (Object) height + - (String) extname

      -

      -providing access to update the anchor’s height attribute -

      + +

      returns the extension of image_src without the preceeding '.'

      -

      Parameters:

      -
        + +

        Returns:

        +
        • - v - - (Integer) + (String) @@ -970,52 +968,38 @@ providing access to update the anchor’s height attribute
        - -

        See Also:

        -
          - -
        • OneCellAnchor.width
        • - -
        -
       
       
      -23
      -24
      -25
      +70 +71 +72
      -
      # File 'lib/axlsx/drawing/pic.rb', line 23
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 70
       
      -def height
      -  @anchor.height
      -end
      -
      +def extname + File.extname(image_src).delete('.') unless image_src.nil? +end
      - - -
      -

      +

      - - (String) image_src + - (String) file_name

      -

      -The path to the image you want to include Only local images are supported -at this time and only jpg support -

      + +

      The file name of image_src without any path information

      @@ -1042,50 +1026,46 @@ at this time and only jpg support
       
       
      -32
      -33
      -34
      +64 +65 +66 -
      # File 'lib/axlsx/drawing/pic.rb', line 32
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 64
       
      -def image_src
      -  @image_src
      -end
      -
      +def file_name + File.basename(image_src) unless image_src.nil? +end
      - - -
      -

      +

      - - (Index) index (readonly) + - (Object) height

      -

      -The index of this image in the workbooks images collections -

      + +

      providing access to update the anchor's height attribute

      - -

      Returns:

      -
        +

        Parameters:

        +
        • + v - (Index) + + (Integer) @@ -1093,62 +1073,57 @@ The index of this image in the workbooks images collections
        + +

        See Also:

        +
          + +
        • OneCellAnchor.width
        • + +
        +
       
       
      -52
      -53
      -54
      +101 +102 +103
      -
      # File 'lib/axlsx/drawing/pic.rb', line 52
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 101
       
      -def index
      -  @anchor.drawing.worksheet.workbook.images.index(self)
      -end
      -
      +def height + @anchor.height +end
      - - -
      -

      +

      - - (String) name + - (Object) height=(v)

      -

      -The name to use for this picture -

      - +
      -

      Returns:

      -
        - -
      • - - - (String) - - - -
      • - -
      + +

      See Also:

      +
        + +
      • height
      • + +
      @@ -1156,38 +1131,32 @@ The name to use for this picture
       
       
      -13
      -14
      -15
      +106 +107 +108
      -
      # File 'lib/axlsx/drawing/pic.rb', line 13
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 106
       
      -def name
      -  @name
      -end
      -
      +def height=(v) + @anchor.height = v +end
      - - -
      -

      +

      - - (String) pn (readonly) + - (Index) index

      -

      -The part name for this image used in serialization and relationship -building -

      + +

      The index of this image in the workbooks images collections

      @@ -1200,7 +1169,7 @@ building
    • - (String) + (Index) @@ -1214,51 +1183,46 @@ building
       
       
      -48
      -49
      -50
      +76 +77 +78 -
      # File 'lib/axlsx/drawing/pic.rb', line 48
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 76
       
      -def pn
      -  "#{IMAGE_PN % [(index+1), extname]}"
      -end
      -
      +def index + @anchor.drawing.worksheet.workbook.images.index(self) +end
    • - - -
      -

      +

      - - (Object) width + - (String) pn

      -

      -providing access to the anchor’s width attribute -

      + +

      The part name for this image used in serialization and relationship +building

      -

      Parameters:

      -
        + +

        Returns:

        +
        • - v - - (Integer) + (String) @@ -1266,45 +1230,29 @@ providing access to the anchor’s width attribute
        - -

        See Also:

        -
          - -
        • OneCellAnchor.width
        • - -
        -
       
       
      -18
      -19
      -20
      +82 +83 +84
      -
      # File 'lib/axlsx/drawing/pic.rb', line 18
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 82
       
      -def width
      -  @anchor.width
      -end
      -
      +def pn + "#{IMAGE_PN % [(index+1), extname]}" +end
      -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

      - (Marker) start_at(x, y) @@ -1312,11 +1260,10 @@ providing access to the anchor’s width attribute

      -

      -This is a short cut method to set the start anchor position If you need + +

      This is a short cut method to set the start anchor position If you need finer granularity in positioning use graphic_frame.anchor.from.colOff / -rowOff -

      +rowOff

      @@ -1335,9 +1282,8 @@ rowOff — -

      -The column -

      +
      +

      The column

      @@ -1352,9 +1298,8 @@ The column — -

      -The row -

      +
      +

      The row

      @@ -1381,19 +1326,18 @@ The row
       
       
      -124
      -125
      -126
      -127
      +116 +117 +118 +119 -
      # File 'lib/axlsx/drawing/pic.rb', line 124
      +      
      # File 'lib/axlsx/drawing/pic.rb', line 116
       
      -def start_at(x, y)
      -  @anchor.from.col = x
      -  @anchor.from.row = y
      -end
      -
      +def start_at(x, y) + @anchor.from.col = x + @anchor.from.row = y +end
      @@ -1408,9 +1352,8 @@ The row

      -

      -Serializes the picture -

      + +

      Serializes the picture

      @@ -1429,9 +1372,8 @@ Serializes the picture — -

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

      +
      +

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

      @@ -1458,6 +1400,14 @@ The document builder instance this objects xml will be added to.
       
       
      +124
      +125
      +126
      +127
      +128
      +129
      +130
      +131
       132
       133
       134
      @@ -1474,45 +1424,141 @@ The document builder instance this objects xml will be added to.
       145
       146
       147
      -148
      -149
      -150
      -151
      -152
      -153
      -154
      -155
      -156
      +148 -
      # File 'lib/axlsx/drawing/pic.rb', line 132
      -
      -def to_xml(xml)
      -  xml.send('xdr:pic') {
      -    xml.send('xdr:nvPicPr') {
      -      xml.send('xdr:cNvPr', :id=>"2", :name=>name, :descr=>descr)
      -      xml.send('xdr:cNvPicPr') {
      -        xml.send('a:picLocks', :noChangeAspect=>1)
      -      }
      -    }
      -    xml.send('xdr:blipFill') {
      -      xml.send('a:blip', :'xmlns:r' => XML_NS_R, :'r:embed'=>"rId1")
      -      xml.send('a:stretch') {
      -        xml.send('a:fillRect')
      -      }
      -    }
      -    xml.send('xdr:spPr') {
      -      xml.send('a:xfrm') {
      -        xml.send('a:off', :x=>0, :y=>0)
      -        xml.send('a:ext', :cx=>2336800, :cy=>2161540)
      -      }
      -      xml.send('a:prstGeom', :prst=>:rect) {
      -        xml.send('a:avLst')
      -      }
      -    }
      -  }
      -end
      -
      +
      # File 'lib/axlsx/drawing/pic.rb', line 124
      +
      +def to_xml(xml)
      +  xml.send('xdr:pic') {
      +    xml.send('xdr:nvPicPr') {
      +      xml.send('xdr:cNvPr', :id=>"2", :name=>name, :descr=>descr)
      +      xml.send('xdr:cNvPicPr') {
      +        xml.send('a:picLocks', :noChangeAspect=>1)
      +      }
      +    }
      +    xml.send('xdr:blipFill') {
      +      xml.send('a:blip', :xmlns:r' => XML_NS_R, :r:embed'=>"rId1")
      +      xml.send('a:stretch') {
      +        xml.send('a:fillRect')
      +      }
      +    }
      +    xml.send('xdr:spPr') {
      +      xml.send('a:xfrm') {
      +        xml.send('a:off', :x=>0, :y=>0)
      +        xml.send('a:ext', :cx=>2336800, :cy=>2161540)
      +      }
      +      xml.send('a:prstGeom', :prst=>:rect) {
      +        xml.send('a:avLst')
      +      }
      +    }
      +  }
      +end
      + + + +
      + +
      +

      + + - (Object) width + + + +

      +
      + +

      providing access to the anchor's width attribute

      + + +
      +
      +
      +

      Parameters:

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

      See Also:

      +
        + +
      • OneCellAnchor.width
      • + +
      + +
      + + + + +
      +
      +
      +
      +89
      +90
      +91
      +
      +
      # File 'lib/axlsx/drawing/pic.rb', line 89
      +
      +def width
      +  @anchor.width
      +end
      +
      +
      + +
      +

      + + - (Object) width=(v) + + + +

      +
      + + +
      +
      +
      + + +

      See Also:

      +
        + +
      • width
      • + +
      + +
      + + +
      +
      +
      +
      +94
      +95
      +96
      +
      +
      # File 'lib/axlsx/drawing/pic.rb', line 94
      +
      +def width=(v)
      +  @anchor.width = v
      +end
      @@ -1523,9 +1569,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Pie3DChart.html b/doc/Axlsx/Pie3DChart.html index b0b9ea0c..dd55e82e 100644 --- a/doc/Axlsx/Pie3DChart.html +++ b/doc/Axlsx/Pie3DChart.html @@ -6,7 +6,7 @@ Class: Axlsx::Pie3DChart - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,10 +96,9 @@

      Overview

      -

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

      + +

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

      @@ -132,7 +131,7 @@ that you can add to your worksheet.

      Instance Attribute Summary

      Attributes inherited from Chart

      -

      graphic_frame, index, pn, series, series_type, show_legend, style, title, view3D

      +

      graphic_frame, series, series_type, show_legend, style, title, view3D

      @@ -161,9 +160,8 @@ that you can add to your worksheet. -

      -Creates a new pie chart object. -

      +
      +

      Creates a new pie chart object.

      @@ -185,9 +183,8 @@ Creates a new pie chart object. -

      -Serializes the pie chart. -

      +
      +

      Serializes the pie chart.

      @@ -205,7 +202,7 @@ Serializes the pie chart.

      Methods inherited from Chart

      -

      #add_series, #end_at, #from, #start_at, #to

      +

      #add_series, #end_at, #from, #index, #pn, #start_at, #to

      Constructor Details

      @@ -218,9 +215,8 @@ Serializes the pie chart.

      -

      -Creates a new pie chart object -

      + +

      Creates a new pie chart object

      @@ -239,9 +235,8 @@ Creates a new pie chart object — -

      -The workbook that owns this chart. -

      +
      +

      The workbook that owns this chart.

      @@ -258,9 +253,8 @@ The workbook that owns this chart. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -393,12 +387,11 @@ a customizable set of options
      # File 'lib/axlsx/drawing/pie_3D_chart.rb', line 24
       
      -def initialize(frame, options={})
      -  super(frame, options)
      -  @series_type = PieSeries
      -  @view3D = View3D.new({:rotX=>30, :perspective=>30}.merge(options))
      -end
      -
      +def initialize(frame, options={}) + super(frame, options) + @series_type = PieSeries + @view3D = View3D.new({:rotX=>30, :perspective=>30}.merge(options)) +end @@ -420,9 +413,8 @@ a customizable set of options

      -

      -Serializes the pie chart -

      + +

      Serializes the pie chart

      @@ -461,15 +453,14 @@ Serializes the pie chart
      # File 'lib/axlsx/drawing/pie_3D_chart.rb', line 32
       
      -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
      -
      +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 @@ -480,9 +471,9 @@ Serializes the pie chart
      diff --git a/doc/Axlsx/PieSeries.html b/doc/Axlsx/PieSeries.html index 93de2b0a..312c62b8 100644 --- a/doc/Axlsx/PieSeries.html +++ b/doc/Axlsx/PieSeries.html @@ -6,7 +6,7 @@ Class: Axlsx::PieSeries - — Documentation by YARD 0.7.3 + — AXLSX @@ -99,16 +99,14 @@
      Note: -

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

      +
      +

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

      -

      -A PieSeries defines the data and labels and explosion for pie charts -series. -

      + +

      A PieSeries defines the data and labels and explosion for pie charts +series.

      @@ -153,9 +151,8 @@ series. -

      -The data for this series. -

      +
      +

      The data for this series.

      @@ -180,9 +177,8 @@ The data for this series. -

      -The explosion for this series. -

      +
      +

      The explosion for this series.

      @@ -207,9 +203,8 @@ The explosion for this series. -

      -The labels for this series. -

      +
      +

      The labels for this series.

      @@ -225,7 +220,7 @@ The labels for this series.

      Attributes inherited from Series

      -

      chart, index, order, title

      +

      chart, title

      @@ -254,9 +249,8 @@ The labels for this series. -

      -Creates a new series. -

      +
      +

      Creates a new series.

      @@ -278,9 +272,8 @@ Creates a new series. -

      -Serializes the series. -

      +
      +

      Serializes the series.

      @@ -294,7 +287,12 @@ Serializes the series. -
      + + + +

      Methods inherited from Series

      +

      #index, #order, #order=

      +

      Constructor Details

      @@ -306,9 +304,8 @@ Serializes the series.

      -

      -Creates a new series -

      + +

      Creates a new series

      @@ -340,9 +337,8 @@ Creates a new series — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -407,17 +403,18 @@ a customizable set of options 27 28 29 -30 +30 +31
      # File 'lib/axlsx/drawing/pie_series.rb', line 26
       
      -def initialize(chart, options={})
      -  super(chart, options)
      -  self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
      -  self.data = ValAxisData.new(options[:data]) unless options[:data].nil?
      -end
      -
      +def initialize(chart, options={}) + @explosion = nil + super(chart, options) + self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? + self.data = ValAxisData.new(options[:data]) unless options[:data].nil? +end @@ -440,9 +437,8 @@ a customizable set of options

      -

      -The data for this series. -

      + +

      The data for this series.

      @@ -476,10 +472,9 @@ The data for this series.
      # File 'lib/axlsx/drawing/pie_series.rb', line 10
       
      -def data
      -  @data
      -end
      -
      +def data + @data +end @@ -497,9 +492,8 @@ The data for this series.

      -

      -The explosion for this series -

      + +

      The explosion for this series

      @@ -533,10 +527,9 @@ The explosion for this series
      # File 'lib/axlsx/drawing/pie_series.rb', line 18
       
      -def explosion
      -  @explosion
      -end
      -
      +def explosion + @explosion +end @@ -554,9 +547,8 @@ The explosion for this series

      -

      -The labels for this series. -

      + +

      The labels for this series.

      @@ -590,10 +582,9 @@ The labels for this series.
      # File 'lib/axlsx/drawing/pie_series.rb', line 14
       
      -def labels
      -  @labels
      -end
      -
      +def labels + @labels +end @@ -615,9 +606,8 @@ The labels for this series.

      -

      -Serializes the series -

      + +

      Serializes the series

      @@ -636,9 +626,8 @@ Serializes the series — -

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

      +
      +

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

      @@ -665,25 +654,24 @@ The document builder instance this objects xml will be added to.
       
       
      -37
      -38
       39
       40
       41
       42
      -43
      +43 +44 +45 -
      # File 'lib/axlsx/drawing/pie_series.rb', line 37
      -
      -def to_xml(xml)
      -  super(xml) do  |xml|
      -    xml.send('c:explosion', :val=>@explosion) unless @explosion.nil?
      -    @labels.to_xml(xml) unless @labels.nil?
      -    @data.to_xml(xml) unless @data.nil?
      -  end      
      -end
      -
      +
      # File 'lib/axlsx/drawing/pie_series.rb', line 39
      +
      +def to_xml(xml)
      +  super(xml) do  |xml_inner|
      +    xml_inner.send('c:explosion', :val=>@explosion) unless @explosion.nil?
      +    @labels.to_xml(xml_inner) unless @labels.nil?
      +    @data.to_xml(xml_inner) unless @data.nil?
      +  end      
      +end
      @@ -694,9 +682,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/RegexValidator.html b/doc/Axlsx/RegexValidator.html index 5335e4a7..398202ce 100644 --- a/doc/Axlsx/RegexValidator.html +++ b/doc/Axlsx/RegexValidator.html @@ -6,7 +6,7 @@ Class: Axlsx::RegexValidator - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

      -Validates the value against the regular expression provided. -

      + +

      Validates the value against the regular expression provided.

      @@ -174,10 +173,9 @@ Validates the value against the regular expression provided. — -

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

      +
      +

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

      @@ -192,9 +190,8 @@ the value is invalid — -

      -The regular expression to evaluate -

      +
      +

      The regular expression to evaluate

      @@ -209,9 +206,8 @@ The regular expression to evaluate — -

      -The value to validate. -

      +
      +

      The value to validate.

      @@ -245,10 +241,9 @@ The value to validate.
      # 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
      -
      +def self.validate(name, regex, v) + raise ArgumentError, (ERR_REGEX % [v.inspect, regex.to_s]) unless (v.respond_to?(:=~) && v =~ regex) +end @@ -259,9 +254,9 @@ The value to validate.
      diff --git a/doc/Axlsx/Relationship.html b/doc/Axlsx/Relationship.html index 9aa93e52..e2fb7a6d 100644 --- a/doc/Axlsx/Relationship.html +++ b/doc/Axlsx/Relationship.html @@ -6,7 +6,7 @@ Class: Axlsx::Relationship - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,15 +97,13 @@
      Note: -

      -Packages automatcially manage relationships. -

      +
      +

      Packages automatcially manage relationships.

      -

      -A relationship defines a reference between package parts. -

      + +

      A relationship defines a reference between package parts.

      @@ -137,9 +135,8 @@ A relationship defines a reference between package parts. -

      -The location of the relationship target. -

      +
      +

      The location of the relationship target.

      @@ -164,9 +161,8 @@ The location of the relationship target. -

      -The type of relationship. -

      +
      +

      The type of relationship.

      @@ -203,9 +199,8 @@ The type of relationship. -

      -A new instance of Relationship. -

      +
      +

      A new instance of Relationship.

      @@ -227,9 +222,8 @@ A new instance of Relationship. -

      -Serializes the relationship. -

      +
      +

      Serializes the relationship.

      @@ -250,9 +244,8 @@ Serializes the relationship.

      -

      -A new instance of Relationship -

      + +

      A new instance of Relationship

      @@ -274,11 +267,10 @@ A new instance of Relationship
      # File 'lib/axlsx/rels/relationship.rb', line 24
       
      -def initialize(type, target)
      -  self.Target=target
      -  self.Type=type
      -end
      -
      +def initialize(type, target) + self.Target=target + self.Type=type +end @@ -301,9 +293,8 @@ A new instance of Relationship

      -

      -The location of the relationship target -

      + +

      The location of the relationship target

      @@ -337,10 +328,9 @@ The location of the relationship target
      # File 'lib/axlsx/rels/relationship.rb', line 8
       
      -def Target
      -  @Target
      -end
      -
      +def Target + @Target +end @@ -361,15 +351,13 @@ The location of the relationship target
      Note: -

      -Supported types are defined as constants in Axlsx: -

      +
      +

      Supported types are defined as constants in Axlsx:

      -

      -The type of relationship -

      + +

      The type of relationship

      @@ -428,10 +416,9 @@ The type of relationship
      # File 'lib/axlsx/rels/relationship.rb', line 23
       
      -def Type
      -  @Type
      -end
      -
      +def Type + @Type +end @@ -453,9 +440,8 @@ The type of relationship

      -

      -Serializes the relationship -

      + +

      Serializes the relationship

      @@ -474,9 +460,8 @@ Serializes the relationship — -

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

      +
      +

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

      @@ -491,9 +476,8 @@ The document builder instance this objects xml will be added to. — -

      -the reference id of the object. -

      +
      +

      the reference id of the object.

      @@ -520,21 +504,20 @@ the reference id of the object.
       
       
      -36
      -37
       38
       39
      -40
      +40 +41 +42 -
      # File 'lib/axlsx/rels/relationship.rb', line 36
      -
      -def to_xml(xml, rId)
      -  h = self.instance_values
      -  h[:Id] = rId
      -  xml.Relationship(h)
      -end
      -
      +
      # File 'lib/axlsx/rels/relationship.rb', line 38
      +
      +def to_xml(xml, rId)
      +  h = self.instance_values
      +  h[:Id] = rId
      +  xml.Relationship(h)
      +end
      @@ -545,9 +528,9 @@ the reference id of the object.
      diff --git a/doc/Axlsx/Relationships.html b/doc/Axlsx/Relationships.html index f82180e0..b68eff83 100644 --- a/doc/Axlsx/Relationships.html +++ b/doc/Axlsx/Relationships.html @@ -6,7 +6,7 @@ Class: Axlsx::Relationships - — Documentation by YARD 0.7.3 + — AXLSX @@ -99,16 +99,14 @@
      Note: -

      -The package automatically manages releationships. -

      +
      +

      The package automatically manages releationships.

      -

      -Relationships are a collection of Relations that define how package parts -are related. -

      + +

      Relationships are a collection of Relations that define how package parts +are related.

      @@ -159,9 +157,8 @@ are related. -

      -Creates a new Relationships collection based on SimpleTypedList. -

      +
      +

      Creates a new Relationships collection based on SimpleTypedList.

      @@ -183,9 +180,8 @@ Creates a new Relationships collection based on SimpleTypedList. -

      -Serializes the relationships document. -

      +
      +

      Serializes the relationships document.

      @@ -199,12 +195,7 @@ Serializes the relationships document. - - - -

      Methods inherited from SimpleTypedList

      -

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

      -
      +

      Constructor Details

      @@ -216,9 +207,8 @@ Serializes the relationships document.

      -

      -Creates a new Relationships collection based on SimpleTypedList -

      + +

      Creates a new Relationships collection based on SimpleTypedList

      @@ -239,10 +229,9 @@ Creates a new Relationships collection based on SimpleTypedList
      # File 'lib/axlsx/rels/relationships.rb', line 9
       
      -def initialize
      -  super Relationship
      -end
      -
      +def initialize + super Relationship +end @@ -274,9 +263,8 @@ Creates a new Relationships collection based on SimpleTypedList

      -

      -Serializes the relationships document. -

      + +

      Serializes the relationships document.

      @@ -315,15 +303,14 @@ Serializes the relationships document.
      # 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
      -
      +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 @@ -334,9 +321,9 @@ Serializes the relationships document.
      diff --git a/doc/Axlsx/RestrictionValidator.html b/doc/Axlsx/RestrictionValidator.html index 928537b7..32f5900d 100644 --- a/doc/Axlsx/RestrictionValidator.html +++ b/doc/Axlsx/RestrictionValidator.html @@ -6,7 +6,7 @@ Class: Axlsx::RestrictionValidator - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

      -Validate a value against a specific list of allowed values. -

      + +

      Validate a value against a specific list of allowed values.

      @@ -133,9 +132,8 @@ Validate a value against a specific list of allowed values. -

      -Perform validation. -

      +
      +

      Perform validation.

      @@ -159,9 +157,8 @@ Perform validation.

      -

      -Perform validation -

      + +

      Perform validation

      @@ -180,9 +177,8 @@ Perform validation — -

      -The name of what is being validatied. This is included in the error message -

      +
      +

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

      @@ -197,9 +193,8 @@ The name of what is being validatied. This is included in the error message — -

      -The list of choices to validate against -

      +
      +

      The list of choices to validate against

      @@ -214,9 +209,8 @@ The list of choices to validate against — -

      -The value to be validated -

      +
      +

      The value to be validated

      @@ -234,9 +228,8 @@ The value to be validated — -

      -true if validation succeeds. -

      +
      +

      true if validation succeeds.

      @@ -253,9 +246,8 @@ true if validation succeeds. — -

      -Raised if the value provided is not in the list of choices. -

      +
      +

      Raised if the value provided is not in the list of choices.

      @@ -276,11 +268,10 @@ Raised if the value provided is not in the list of choices.
      # 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
      -
      +def self.validate(name, choices, v) + raise ArgumentError, (ERR_RESTRICTION % [v.to_s, name, choices.inspect]) unless choices.include?(v) + true +end @@ -291,9 +282,9 @@ Raised if the value provided is not in the list of choices.
      diff --git a/doc/Axlsx/Row.html b/doc/Axlsx/Row.html index 92ff0d15..84687f5e 100644 --- a/doc/Axlsx/Row.html +++ b/doc/Axlsx/Row.html @@ -6,7 +6,7 @@ Class: Axlsx::Row - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,15 +97,13 @@
      Note: -

      -The recommended way to manage rows and cells is to use Worksheet#add_row -

      +
      +

      The recommended way to manage rows and cells is to use Worksheet#add_row

      -

      -A Row is a single row in a worksheet. -

      + +

      A Row is a single row in a worksheet.

      @@ -144,9 +142,8 @@ A Row is a single row in a worksheet. -

      -The cells this row holds. -

      +
      +

      The cells this row holds.

      @@ -155,14 +152,14 @@ The cells this row holds.
    • - - (Integer) index + - (Worksheet) worksheet - readonly + @@ -171,58 +168,54 @@ The cells this row holds. -

      -The index of this row in the worksheet. -

      +
      +

      The worksheet this row belongs to.

    • -
    • +
    + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (Cell) add_cell(value = "", options = {}) + - (Integer) index @@ -235,10 +228,8 @@ The worksheet this row belongs to. -

      -Adds a singel sell to the row based on the data provided and updates the -worksheet’s autofit data. -

      +
      +

      The index of this row in the worksheet.

    • @@ -262,9 +253,8 @@ worksheet’s autofit data. -

      -Creates a new row. -

      +
      +

      Creates a new row.

      @@ -286,9 +276,8 @@ Creates a new row. -

      -Serializes the row. -

      +
      +

      Serializes the row.

      @@ -309,19 +298,17 @@ Serializes the row.

      -

      -Creates a new row. New Cell objects are created based on the values, types + +

      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.
      -
      +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.
      @@ -353,9 +340,8 @@ style and types options are applied as follows: — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -418,23 +404,22 @@ a customizable set of options
       
       
      +29
      +30
      +31
      +32
       33
      -34
      -35
      -36
      -37
      -38
      +34 -
      # 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
      -
      +
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 29
      +
      +def initialize(worksheet, values=[], options={})
      +  self.worksheet = worksheet
      +  @cells = SimpleTypedList.new Cell
      +  @worksheet.rows << self
      +  array_to_cells(values, options)
      +end
      @@ -457,9 +442,8 @@ a customizable set of options

      -

      -The cells this row holds -

      + +

      The cells this row holds

      @@ -493,30 +477,28 @@ The cells this row holds
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 13
       
      -def cells
      -  @cells
      -end
      -
      +def cells + @cells +end
      - - + +
      -

      +

      - - (Integer) index (readonly) + - (Worksheet) worksheet

      -

      -The index of this row in the worksheet -

      + +

      The worksheet this row belongs to

      @@ -529,7 +511,7 @@ The index of this row in the worksheet
    • - (Integer) + (Worksheet) @@ -543,37 +525,40 @@ The index of this row in the worksheet
       
       
      -17
      -18
      -19
      +9 +10 +11 -
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 17
      +      
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 9
       
      -def index 
      -  worksheet.rows.index(self)
      -end
      -
      +def worksheet + @worksheet +end
    • - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

      - - (Worksheet) worksheet + - (Cell) add_cell(value = "", options = {})

      -

      -The worksheet this row belongs to -

      + +

      Adds a singel sell to the row based on the data provided and updates the +worksheet's autofit data.

      @@ -586,7 +571,7 @@ The worksheet this row belongs to
    • - (Worksheet) + (Cell) @@ -600,42 +585,36 @@ The worksheet this row belongs to
       
       
      -9
      -10
      -11
      +51 +52 +53 +54 +55 -
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 9
      +      
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 51
       
      -def worksheet
      -  @worksheet
      -end
      -
      +def add_cell(value="", options={}) + c = Cell.new(self, value, options) + update_auto_fit_data + c +end
    • -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

      - - (Cell) add_cell(value = "", options = {}) + - (Integer) index

      -

      -Adds a singel sell to the row based on the data provided and updates the -worksheet’s autofit data. -

      + +

      The index of this row in the worksheet

      @@ -648,7 +627,7 @@ worksheet’s autofit data.
    • - (Cell) + (Integer) @@ -662,21 +641,16 @@ worksheet’s autofit data.
       
       
      -53
      -54
      -55
      -56
      -57
      +38 +39 +40 -
      # 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
      -
      +
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 38
      +
      +def index 
      +  worksheet.rows.index(self)
      +end
      @@ -691,9 +665,8 @@ worksheet’s autofit data.

      -

      -Serializes the row -

      + +

      Serializes the row

      @@ -712,9 +685,8 @@ Serializes the row — -

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

      +
      +

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

    • @@ -741,17 +713,16 @@ The document builder instance this objects xml will be added to.
       
       
      -47
      -48
      -49
      +45 +46 +47 -
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 47
      +      
      # File 'lib/axlsx/workbook/worksheet/row.rb', line 45
       
      -def to_xml(xml)
      -  xml.row(:r => index+1) { @cells.each { |cell| cell.to_xml(xml) } }
      -end
      -
      +def to_xml(xml) + xml.row(:r => index+1) { @cells.each { |cell| cell.to_xml(xml) } } +end
      @@ -762,9 +733,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Scaling.html b/doc/Axlsx/Scaling.html index 327e33fc..e8a6a8be 100644 --- a/doc/Axlsx/Scaling.html +++ b/doc/Axlsx/Scaling.html @@ -6,7 +6,7 @@ Class: Axlsx::Scaling - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

      -The Scaling class defines axis scaling -

      + +

      The Scaling class defines axis scaling

      @@ -128,9 +127,8 @@ The Scaling class defines axis scaling -

      -logarithmic base for a logarithmic axis. -

      +
      +

      logarithmic base for a logarithmic axis.

      @@ -155,9 +153,8 @@ logarithmic base for a logarithmic axis. -

      -the maximum scaling. -

      +
      +

      the maximum scaling.

      @@ -182,9 +179,8 @@ the maximum scaling. -

      -the minimu scaling. -

      +
      +

      the minimu scaling.

      @@ -209,9 +205,8 @@ the minimu scaling. -

      -the orientation of the axis must be one of [:minMax, :maxMin]. -

      +
      +

      the orientation of the axis must be one of [:minMax, :maxMin].

      @@ -248,9 +243,8 @@ the orientation of the axis must be one of [:minMax, :maxMin]. -

      -creates a new Scaling object. -

      +
      +

      creates a new Scaling object.

      @@ -272,9 +266,8 @@ creates a new Scaling object. -

      -Serializes the axId. -

      +
      +

      Serializes the axId.

      @@ -295,9 +288,8 @@ Serializes the axId.

      -

      -creates a new Scaling object -

      + +

      creates a new Scaling object

      @@ -318,9 +310,8 @@ creates a new Scaling object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -384,18 +375,19 @@ a customizable set of options 30 31 32 -33 +33 +34
      # 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
      -
      +def initialize(options={}) + @orientation = :minMax + @logBase, @min, @max = nil, nil, nil + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -418,9 +410,8 @@ a customizable set of options

      -

      -logarithmic base for a logarithmic axis. must be between 2 and 1000 -

      + +

      logarithmic base for a logarithmic axis. must be between 2 and 1000

      @@ -454,10 +445,9 @@ logarithmic base for a logarithmic axis. must be between 2 and 1000
      # File 'lib/axlsx/drawing/scaling.rb', line 8
       
      -def logBase
      -  @logBase
      -end
      -
      +def logBase + @logBase +end @@ -475,9 +465,8 @@ logarithmic base for a logarithmic axis. must be between 2 and 1000

      -

      -the maximum scaling -

      + +

      the maximum scaling

      @@ -511,10 +500,9 @@ the maximum scaling
      # File 'lib/axlsx/drawing/scaling.rb', line 17
       
      -def max
      -  @max
      -end
      -
      +def max + @max +end @@ -532,9 +520,8 @@ the maximum scaling

      -

      -the minimu scaling -

      + +

      the minimu scaling

      @@ -568,10 +555,9 @@ the minimu scaling
      # File 'lib/axlsx/drawing/scaling.rb', line 21
       
      -def min
      -  @min
      -end
      -
      +def min + @min +end @@ -589,9 +575,8 @@ the minimu scaling

      -

      -the orientation of the axis must be one of [:minMax, :maxMin] -

      + +

      the orientation of the axis must be one of [:minMax, :maxMin]

      @@ -625,10 +610,9 @@ the orientation of the axis must be one of [:minMax, :maxMin]
      # File 'lib/axlsx/drawing/scaling.rb', line 13
       
      -def orientation
      -  @orientation
      -end
      -
      +def orientation + @orientation +end @@ -650,9 +634,8 @@ the orientation of the axis must be one of [:minMax, :maxMin]

      -

      -Serializes the axId -

      + +

      Serializes the axId

      @@ -671,9 +654,8 @@ Serializes the axId — -

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

      +
      +

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

      @@ -700,27 +682,26 @@ The document builder instance this objects xml will be added to.
       
       
      -43
      -44
      -45
      -46
      -47
      -48
       49
      -50
      +50 +51 +52 +53 +54 +55 +56 -
      # 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
      -
      +
      # File 'lib/axlsx/drawing/scaling.rb', line 49
      +
      +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
      @@ -731,9 +712,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/SerAxis.html b/doc/Axlsx/SerAxis.html index cd476df7..bec08bde 100644 --- a/doc/Axlsx/SerAxis.html +++ b/doc/Axlsx/SerAxis.html @@ -6,7 +6,7 @@ Class: Axlsx::SerAxis - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,9 +96,8 @@

      Overview

      -

      -A SerAxis object defines a series axis -

      + +

      A SerAxis object defines a series axis

      @@ -134,9 +133,8 @@ A SerAxis object defines a series axis -

      -The number of tick lables to skip between labels. -

      +
      +

      The number of tick lables to skip between labels.

      @@ -161,9 +159,8 @@ The number of tick lables to skip between labels. -

      -The number of tickmarks to be skipped before the next one is rendered. -

      +
      +

      The number of tickmarks to be skipped before the next one is rendered.

      @@ -208,9 +205,8 @@ The number of tickmarks to be skipped before the next one is rendered. -

      -Creates a new SerAxis object. -

      +
      +

      Creates a new SerAxis object.

      @@ -232,9 +228,8 @@ Creates a new SerAxis object. -

      -Serializes the series axis. -

      +
      +

      Serializes the series axis.

      @@ -260,9 +255,8 @@ Serializes the series axis.

      -

      -Creates a new SerAxis object -

      + +

      Creates a new SerAxis object

      @@ -281,9 +275,8 @@ Creates a new SerAxis object — -

      -the id of this axis. Inherited -

      +
      +

      the id of this axis. Inherited

      @@ -298,9 +291,8 @@ the id of this axis. Inherited — -

      -the id of the perpendicular axis. Inherited -

      +
      +

      the id of the perpendicular axis. Inherited

      @@ -317,9 +309,8 @@ the id of the perpendicular axis. Inherited — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -342,9 +333,8 @@ a customizable set of options - —

      -Inherited -

      + —
      +

      Inherited

      @@ -354,9 +344,8 @@ Inherited - —

      -Inherited -

      + —
      +

      Inherited

      @@ -366,9 +355,8 @@ Inherited - —

      -Inherited -

      + —
      +

      Inherited

      @@ -402,15 +390,16 @@ Inherited 21 22 -23 +23 +24
      # File 'lib/axlsx/drawing/ser_axis.rb', line 21
       
      -def initialize(axId, crossAx, options={})
      -  super(axId, crossAx, options)
      -end
      -
      +def initialize(axId, crossAx, options={}) + @tickLblSkip, @tickMarkSkip = nil, nil + super(axId, crossAx, options) +end @@ -433,9 +422,8 @@ Inherited

      -

      -The number of tick lables to skip between labels -

      + +

      The number of tick lables to skip between labels

      @@ -469,10 +457,9 @@ The number of tick lables to skip between labels
      # File 'lib/axlsx/drawing/ser_axis.rb', line 7
       
      -def tickLblSkip
      -  @tickLblSkip
      -end
      -
      +def tickLblSkip + @tickLblSkip +end @@ -490,9 +477,8 @@ The number of tick lables to skip between labels

      -

      -The number of tickmarks to be skipped before the next one is rendered. -

      + +

      The number of tickmarks to be skipped before the next one is rendered.

      @@ -526,10 +512,9 @@ The number of tickmarks to be skipped before the next one is rendered.
      # File 'lib/axlsx/drawing/ser_axis.rb', line 11
       
      -def tickMarkSkip
      -  @tickMarkSkip
      -end
      -
      +def tickMarkSkip + @tickMarkSkip +end @@ -551,9 +536,8 @@ The number of tickmarks to be skipped before the next one is rendered.

      -

      -Serializes the series axis -

      + +

      Serializes the series axis

      @@ -572,9 +556,8 @@ Serializes the series axis — -

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

      +
      +

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

      @@ -601,25 +584,24 @@ The document builder instance this objects xml will be added to.
       
       
      -31
      -32
      -33
      -34
       35
       36
      -37
      +37 +38 +39 +40 +41 -
      # File 'lib/axlsx/drawing/ser_axis.rb', line 31
      -
      -def to_xml(xml)
      -  xml.send('c:serAx') {
      -    super(xml)
      -    xml.send('c:tickLblSkip', :val=>@tickLblSkip) unless @tickLblSkip.nil?
      -    xml.send('c:tickMarkSkip', :val=>@tickMarkSkip) unless @tickMarkSkip.nil?
      -  }
      -end
      -
      +
      # File 'lib/axlsx/drawing/ser_axis.rb', line 35
      +
      +def to_xml(xml)
      +  xml.send('c:serAx') {
      +    super(xml)
      +    xml.send('c:tickLblSkip', :val=>@tickLblSkip) unless @tickLblSkip.nil?
      +    xml.send('c:tickMarkSkip', :val=>@tickMarkSkip) unless @tickMarkSkip.nil?
      +  }
      +end
      @@ -630,9 +612,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Series.html b/doc/Axlsx/Series.html index 1b6792b5..f93a1220 100644 --- a/doc/Axlsx/Series.html +++ b/doc/Axlsx/Series.html @@ -6,7 +6,7 @@ Class: Axlsx::Series - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
      Note: -

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

      +
      +

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

      -

      -A Series defines the common series attributes and is the super class for -all concrete series types. -

      + +

      A Series defines the common series attributes and is the super class for +all concrete series types.

      @@ -151,9 +149,8 @@ all concrete series types. -

      -The chart that owns this series. -

      +
      +

      The chart that owns this series.

      @@ -162,14 +159,14 @@ The chart that owns this series.
    • - - (Integer) index + - (SeriesTitle) title - readonly + @@ -178,53 +175,60 @@ The chart that owns this series. -

      -The index of this series in the chart’s series. -

      +
      +

      The title of the series.

    • -
    • +
    + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (Series) initialize(chart, options = {}) + - (Integer) order - constructor - @@ -271,9 +259,8 @@ The title of the series. -

      -Creates a new series. -

      +
      +

      The order of this series in the chart's series.

    • @@ -282,7 +269,7 @@ Creates a new series.
    • - - (String) to_xml(xml) + - (Object) order=(v) @@ -295,10 +282,7 @@ Creates a new series. -

      -Serializes the series. -

      -
      +
    • @@ -318,9 +302,8 @@ Serializes the series.

      -

      -Creates a new series -

      + +

      Creates a new series

      @@ -352,9 +335,8 @@ Creates a new series — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -397,25 +379,26 @@ a customizable set of options
       
       
      -28
      -29
      -30
      -31
      -32
      -33
      -34
      +20 +21 +22 +23 +24 +25 +26 +27 -
      # 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
      -
      +
      # File 'lib/axlsx/drawing/series.rb', line 20
      +
      +def initialize(chart, options={})
      +  @order = nil
      +  self.chart = chart
      +  @chart.series << self
      +  options.each do |o|
      +    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      +  end
      +end
      @@ -438,9 +421,8 @@ a customizable set of options

      -

      -The chart that owns this series -

      + +

      The chart that owns this series

      @@ -474,30 +456,28 @@ The chart that owns this series
      # File 'lib/axlsx/drawing/series.rb', line 10
       
      -def chart
      -  @chart
      -end
      -
      +def chart + @chart +end
      - - + +
      -

      +

      - - (Integer) index (readonly) + - (SeriesTitle) title

      -

      -The index of this series in the chart’s series. -

      + +

      The title of the series

      @@ -510,7 +490,7 @@ The index of this series in the chart’s series.
    • - (Integer) + (SeriesTitle) @@ -531,31 +511,32 @@ The index of this series in the chart’s series.
      # File 'lib/axlsx/drawing/series.rb', line 14
       
      -def index
      -  @chart.series.index(self)
      -end
      -
      +def title + @title +end
    • - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

      - - (Integer) order + - (Integer) index

      -

      -The order of this series in the chart’s series. By default the order -is the index of the series. -

      + +

      The index of this series in the chart's series.

      @@ -582,37 +563,33 @@ is the index of the series.
       
       
      -18
      -19
      -20
      +31 +32 +33 -
      # File 'lib/axlsx/drawing/series.rb', line 18
      +      
      # File 'lib/axlsx/drawing/series.rb', line 31
       
      -def order
      -  @order || index
      -end
      -
      +def index + @chart.series.index(self) +end
      - - -
      -

      +

      - - (SeriesTitle) title + - (Integer) order

      -

      -The title of the series -

      + +

      The order of this series in the chart's series. By default the order is the +index of the series.

      @@ -625,7 +602,7 @@ The title of the series
    • - (SeriesTitle) + (Integer) @@ -639,81 +616,43 @@ The title of the series
       
       
      -22
      -23
      -24
      +38 +39 +40 -
      # File 'lib/axlsx/drawing/series.rb', line 22
      +      
      # File 'lib/axlsx/drawing/series.rb', line 38
       
      -def title
      -  @title
      -end
      -
      +def order + @order || index +end
    • -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

      - - (String) to_xml(xml) + - (Object) order=(v)

      -

      -Serializes the series -

      - +
      -

      Parameters:

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

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

        -
        - -
      • - -
      -

      Returns:

      -
        - -
      • - - - (String) - - - -
      • - -
      +

      See Also:

      +
        + +
      • order
      • + +
      @@ -721,27 +660,12 @@ The document builder instance this objects xml will be added to.
       
       
      -60
      -61
      -62
      -63
      -64
      -65
      -66
      -67
      +43
      -
      # File 'lib/axlsx/drawing/series.rb', line 60
      -
      -def to_xml(xml)
      -  xml.send('c:ser') {
      -    xml.send('c:idx', :val=>index)
      -    xml.send('c:order', :val=>order || index)        
      -    title.to_xml(xml) unless title.nil?
      -    yield xml if block_given?
      -  }
      -end
      -
      +
      # File 'lib/axlsx/drawing/series.rb', line 43
      +
      +def order=(v)  Axlsx::validate_unsigned_int(v); @order = v; end
      @@ -752,9 +676,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/SeriesTitle.html b/doc/Axlsx/SeriesTitle.html index d455e01b..e809a40e 100644 --- a/doc/Axlsx/SeriesTitle.html +++ b/doc/Axlsx/SeriesTitle.html @@ -6,7 +6,7 @@ Class: Axlsx::SeriesTitle - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,10 +96,9 @@

      Overview

      -

      -A series title is a Title with a slightly different serialization than -chart titles. -

      + +

      A series title is a Title with a slightly different serialization than +chart titles.

      @@ -148,9 +147,8 @@ chart titles. -

      -Serializes the series title. -

      +
      +

      Serializes the series title.

      @@ -168,7 +166,7 @@ Serializes the series title.

      Methods inherited from Title

      -

      #initialize, #range

      +

      #initialize

      Constructor Details

      @@ -190,9 +188,8 @@ Serializes the series title.

      -

      -Serializes the series title -

      + +

      Serializes the series title

      @@ -211,9 +208,8 @@ Serializes the series title — -

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

      +
      +

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

      @@ -257,20 +253,19 @@ The document builder instance this objects xml will be added to.
      # File 'lib/axlsx/drawing/series_title.rb', line 8
       
      -def to_xml(xml)
      -  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
      -
      +def to_xml(xml) + xml.send('c:tx') { + xml.send('c:strRef') { + xml.send('c:f', Axlsx::cell_range([@cell])) + xml.send('c:strCache') { + xml.send('c:ptCount', :val=>1) + xml.send('c:pt', :idx=>0) { + xml.send('c:v', @text) + } + } + } + } +end @@ -281,9 +276,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/SimpleTypedList.html b/doc/Axlsx/SimpleTypedList.html deleted file mode 100644 index f2136a97..00000000 --- a/doc/Axlsx/SimpleTypedList.html +++ /dev/null @@ -1,1686 +0,0 @@ - - - - - - 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

      -

      CatAxisData, ContentType, Relationships, TableStyle, TableStyles

      -
      - - -

      Instance Attribute Summary (collapse)

      -
        - -
      • - - - - (Array) allowed_types - - - - - - - readonly - - - - - - - - -

        -The class constants of allowed types. -

        -
        - -
      • - - -
      • - - - - (Integer) locked_at - - - - - - - readonly - - - - - - - - -

        -The index below which items cannot be removed. -

        -
        - -
      • - - -
      • - - - - (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. -

        -
        - -
      • - - -
      - - - - - -

      - 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
      -
      -
      -
      - -

      -method_mission override to pass allowed methods to the list. -

      - - -
      -
      -
      - -

      Raises:

      -
        - -
      • - - - (ArgumentError) - - - -
      • - -
      - -
      - - - - -
      -
      -
      -
      -131
      -132
      -133
      -134
      -135
      -136
      -137
      -138
      -139
      -
      -
      # File 'lib/axlsx/util/simple_typed_list.rb', line 131
      -
      -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].include? meth.to_sym        
      -  if @list.respond_to? meth
      -    @list.send(meth, *args, &block)      
      -  else
      -    puts "method:#{meth.inspect}"
      -    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) ==(v) - - - -

      -
      -

      -override the equality method so that this object can be compared to a -simple array. if this object’s list is equal to the specifiec array, -we return true. -

      - - -
      -
      -
      - - -
      - - - - -
      -
      -
      -
      -105
      -106
      -107
      -
      -
      # File 'lib/axlsx/util/simple_typed_list.rb', line 105
      -
      -def ==(v)
      -  v == @list
      -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) - - - -
      • - -
      - -
      - - - - -
      -
      -
      -
      -146
      -147
      -148
      -149
      -150
      -151
      -152
      -
      -
      # File 'lib/axlsx/util/simple_typed_list.rb', line 146
      -
      -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 index b429ec58..f0eff10d 100644 --- a/doc/Axlsx/Styles.html +++ b/doc/Axlsx/Styles.html @@ -6,7 +6,7 @@ Class: Axlsx::Styles - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,20 +97,18 @@
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      The recommended way to manage styles is with add_style

      -

      -The Styles class manages worksheet styles In addition to creating the + +

      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. -

      +and exLst, whic is used as a future feature data storage area.

      @@ -151,10 +149,9 @@ and exLst, whic is used as a future feature data storage area. -

      -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. -

      +
      +

      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.

      @@ -179,10 +176,9 @@ THIN_BORDER which can be used to put a border around all of your cells. -

      -The collection of named styles, referencing cellStyleXfs items in the -workbook. -

      +
      +

      The collection of named styles, referencing cellStyleXfs items in the +workbook.

      @@ -207,10 +203,9 @@ workbook. -

      -The collection of master formatting records for named cell styles, which -means records defined in cellStyles, in the workbook. -

      +
      +

      The collection of master formatting records for named cell styles, which +means records defined in cellStyles, in the workbook.

      @@ -235,9 +230,8 @@ means records defined in cellStyles, in the workbook. -

      -The collection of master formatting records. -

      +
      +

      The collection of master formatting records.

      @@ -262,9 +256,8 @@ The collection of master formatting records. -

      -The collection of non-cell formatting records used in the worksheet. -

      +
      +

      The collection of non-cell formatting records used in the worksheet.

      @@ -289,9 +282,8 @@ The collection of non-cell formatting records used in the worksheet. -

      -The collection of fills used in this workbook. -

      +
      +

      The collection of fills used in this workbook.

      @@ -316,9 +308,8 @@ The collection of fills used in this workbook. -

      -The collection of fonts used in this workbook. -

      +
      +

      The collection of fonts used in this workbook.

      @@ -343,9 +334,8 @@ The collection of fonts used in this workbook. -

      -numFmts for your styles. -

      +
      +

      numFmts for your styles.

      @@ -370,10 +360,9 @@ numFmts for your styles. -

      -The collection of table styles that will be available to the user in the -excel UI. -

      +
      +

      The collection of table styles that will be available to the user in the +excel UI.

      @@ -408,9 +397,8 @@ excel UI. -

      -Drastically simplifies style creation and management. -

      +
      +

      Drastically simplifies style creation and management.

      @@ -434,10 +422,9 @@ Drastically simplifies style creation and management. -

      -Creates a new Styles object and prepopulates it with the requires objects -to generate a valid package style part. -

      +
      +

      Creates a new Styles object and prepopulates it with the requires objects +to generate a valid package style part.

      @@ -459,9 +446,8 @@ to generate a valid package style part. -

      -Serializes the styles document. -

      +
      +

      Serializes the styles document.

      @@ -482,10 +468,9 @@ Serializes the styles document.

      -

      -Creates a new Styles object and prepopulates it with the requires objects -to generate a valid package style part. -

      + +

      Creates a new Styles object and prepopulates it with the requires objects +to generate a valid package style part.

      @@ -506,10 +491,9 @@ to generate a valid package style part.
      # File 'lib/axlsx/stylesheet/styles.rb', line 118
       
      -def initialize()
      -  load_default_styles
      -end
      -
      +def initialize() + load_default_styles +end @@ -535,16 +519,14 @@ to generate a valid package style part.
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      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. -

      + +

      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.

      @@ -585,10 +567,9 @@ THIN_BORDER which can be used to put a border around all of your cells.
      # File 'lib/axlsx/stylesheet/styles.rb', line 85
       
      -def borders
      -  @borders
      -end
      -
      +def borders + @borders +end @@ -609,16 +590,14 @@ THIN_BORDER which can be used to put a border around all of your cells.
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      The recommended way to manage styles is with add_style

      -

      -The collection of named styles, referencing cellStyleXfs items in the -workbook. -

      + +

      The collection of named styles, referencing cellStyleXfs items in the +workbook.

      @@ -659,10 +638,9 @@ workbook.
      # File 'lib/axlsx/stylesheet/styles.rb', line 97
       
      -def cellStyles
      -  @cellStyles
      -end
      -
      +def cellStyles + @cellStyles +end @@ -683,16 +661,14 @@ workbook.
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      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 -

      + +

      The collection of master formatting records for named cell styles, which +means records defined in cellStyles, in the workbook

      @@ -733,10 +709,9 @@ means records defined in cellStyles, in the workbook
      # File 'lib/axlsx/stylesheet/styles.rb', line 91
       
      -def cellStyleXfs
      -  @cellStyleXfs
      -end
      -
      +def cellStyleXfs + @cellStyleXfs +end @@ -757,16 +732,14 @@ means records defined in cellStyles, in the workbook
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      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. -

      + +

      The collection of master formatting records. This is the list that you will +actually use in styling a workbook.

      @@ -807,10 +780,9 @@ actually use in styling a workbook.
      # File 'lib/axlsx/stylesheet/styles.rb', line 103
       
      -def cellXfs
      -  @cellXfs
      -end
      -
      +def cellXfs + @cellXfs +end @@ -831,15 +803,13 @@ actually use in styling a workbook.
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      The recommended way to manage styles is with add_style

      -

      -The collection of non-cell formatting records used in the worksheet. -

      + +

      The collection of non-cell formatting records used in the worksheet.

      @@ -880,10 +850,9 @@ The collection of non-cell formatting records used in the worksheet.
      # File 'lib/axlsx/stylesheet/styles.rb', line 109
       
      -def dxfs
      -  @dxfs
      -end
      -
      +def dxfs + @dxfs +end @@ -904,15 +873,13 @@ The collection of non-cell formatting records used in the worksheet.
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      The recommended way to manage styles is with add_style

      -

      -The collection of fills used in this workbook -

      + +

      The collection of fills used in this workbook

      @@ -953,10 +920,9 @@ The collection of fills used in this workbook
      # File 'lib/axlsx/stylesheet/styles.rb', line 78
       
      -def fills
      -  @fills
      -end
      -
      +def fills + @fills +end @@ -977,15 +943,13 @@ The collection of fills used in this workbook
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      The recommended way to manage styles is with add_style

      -

      -The collection of fonts used in this workbook -

      + +

      The collection of fonts used in this workbook

      @@ -1026,10 +990,9 @@ The collection of fonts used in this workbook
      # File 'lib/axlsx/stylesheet/styles.rb', line 72
       
      -def fonts
      -  @fonts
      -end
      -
      +def fonts + @fonts +end @@ -1050,51 +1013,48 @@ The collection of fonts used in this workbook
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      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"
      -
      + +

      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"
      @@ -1137,10 +1097,9 @@ numFmts for your styles.
      # File 'lib/axlsx/stylesheet/styles.rb', line 66
       
      -def numFmts
      -  @numFmts
      -end
      -
      +def numFmts + @numFmts +end @@ -1161,16 +1120,14 @@ numFmts for your styles.
      Note: -

      -The recommended way to manage styles is with add_style -

      +
      +

      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 -

      + +

      The collection of table styles that will be available to the user in the +excel UI

      @@ -1211,10 +1168,9 @@ excel UI
      # File 'lib/axlsx/stylesheet/styles.rb', line 115
       
      -def tableStyles
      -  @tableStyles
      -end
      -
      +def tableStyles + @tableStyles +end @@ -1236,9 +1192,8 @@ excel UI

      -

      -Drastically simplifies style creation and management. -

      + +

      Drastically simplifies style creation and management.

      @@ -1248,63 +1203,59 @@ Drastically simplifies style creation and management.

      Examples:

      -

      -You Got Style -

      +

      +

      You Got Style

      -
      require "rubygems" # if that is your preferred way to manage gems!
      -require "axlsx"
      +      
      require "rubygems" # if that is your preferred way to manage gems!
      +require "axlsx"
       
      -p = Axlsx::Package.new
      -ws = p.workbook.add_worksheet
      +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
      +# 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)
      -
      +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 -

      +

      +

      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)
      -
      +
      # 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:

      @@ -1322,9 +1273,8 @@ Styling specifically — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -1343,9 +1293,8 @@ a customizable set of options - —

      -The text color -

      + —
      +

      The text color

      @@ -1355,9 +1304,8 @@ The text color - —

      -The text size -

      + —
      +

      The text size

      @@ -1367,9 +1315,8 @@ The text size - —

      -Indicates if the text should be bold -

      + —
      +

      Indicates if the text should be bold

      @@ -1379,9 +1326,8 @@ Indicates if the text should be bold - —

      -Indicates if the text should be italicised -

      + —
      +

      Indicates if the text should be italicised

      @@ -1391,9 +1337,8 @@ Indicates if the text should be italicised - —

      -Indicates if the text should be rendered with a strikethrough -

      + —
      +

      Indicates if the text should be rendered with a strikethrough

      @@ -1403,9 +1348,8 @@ Indicates if the text should be rendered with a strikethrough - —

      -Indicates if the text should be rendered with a shadow -

      + —
      +

      Indicates if the text should be rendered with a shadow

      @@ -1415,9 +1359,8 @@ Indicates if the text should be rendered with a shadow - —

      -The character set to use. -

      + —
      +

      The character set to use.

      @@ -1427,9 +1370,8 @@ The character set to use. - —

      -The font family to use. -

      + —
      +

      The font family to use.

      @@ -1439,9 +1381,8 @@ The font family to use. - —

      -The name of the font to use -

      + —
      +

      The name of the font to use

      @@ -1451,9 +1392,8 @@ The name of the font to use - —

      -The number format to apply -

      + —
      +

      The number format to apply

      @@ -1463,9 +1403,8 @@ The number format to apply - —

      -The formatting to apply. If this is specified, num_fmt is ignored. -

      + —
      +

      The formatting to apply. If this is specified, num_fmt is ignored.

      @@ -1475,9 +1414,8 @@ The formatting to apply. If this is specified, num_fmt is ignored. - —

      -The border style to use. -

      + —
      +

      The border style to use.

      @@ -1487,9 +1425,8 @@ The border style to use. - —

      -The background color to apply to the cell -

      + —
      +

      The background color to apply to the cell

      @@ -1499,9 +1436,8 @@ The background color to apply to the cell - —

      -Indicates if the cell should be hidden -

      + —
      +

      Indicates if the cell should be hidden

      @@ -1511,9 +1447,8 @@ Indicates if the cell should be hidden - —

      -Indicates if the cell should be locked -

      + —
      +

      Indicates if the cell should be locked

      @@ -1523,9 +1458,8 @@ Indicates if the cell should be locked - —

      -A hash defining any of the attributes used in CellAlignment -

      + —
      +

      A hash defining any of the attributes used in CellAlignment

      @@ -1621,52 +1555,51 @@ A hash defining any of the attributes used in CellAlignment
      # 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
      -
      +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 @@ -1681,9 +1614,8 @@ A hash defining any of the attributes used in CellAlignment

      -

      -Serializes the styles document -

      + +

      Serializes the styles document

      @@ -1724,17 +1656,16 @@ Serializes the styles document
      # 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
      -
      +def to_xml() + builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml| + xml.styleSheet(:xmlns => XML_NS) { + [:numFmts, :fonts, :fills, :borders, :cellStyleXfs, :cellXfs, :cellStyles, :dxfs, :tableStyles].each do |key| + self.instance_values[key.to_s].to_xml(xml) + end + } + end + builder.to_xml +end @@ -1745,9 +1676,9 @@ Serializes the styles document
      diff --git a/doc/Axlsx/TableStyle.html b/doc/Axlsx/TableStyle.html index 88399487..1f43f1e9 100644 --- a/doc/Axlsx/TableStyle.html +++ b/doc/Axlsx/TableStyle.html @@ -6,7 +6,7 @@ Class: Axlsx::TableStyle - — Documentation by YARD 0.7.3 + — AXLSX @@ -99,16 +99,14 @@
      Note: -

      -Table are not supported in this version and only the defaults required for -a valid workbook are created. -

      +
      +

      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 -

      + +

      A single table style definition and is a collection for tableStyleElements

      @@ -144,9 +142,8 @@ A single table style definition and is a collection for tableStyleElements -

      -The name of this table style. -

      +
      +

      The name of this table style.

      @@ -171,9 +168,8 @@ The name of this table style. -

      -indicates if this style should be applied to pivot tables. -

      +
      +

      indicates if this style should be applied to pivot tables.

      @@ -198,9 +194,8 @@ indicates if this style should be applied to pivot tables. -

      -indicates if this style should be applied to tables. -

      +
      +

      indicates if this style should be applied to tables.

      @@ -245,9 +240,8 @@ indicates if this style should be applied to tables. -

      -creates a new TableStyle object. -

      +
      +

      creates a new TableStyle object.

      @@ -269,9 +263,8 @@ creates a new TableStyle object. -

      -Serializes the table style. -

      +
      +

      Serializes the table style.

      @@ -285,12 +278,7 @@ Serializes the table style. - - - -

      Methods inherited from SimpleTypedList

      -

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

      -
      +

      Constructor Details

      @@ -302,9 +290,8 @@ Serializes the table style.

      -

      -creates a new TableStyle object -

      + +

      creates a new TableStyle object

      @@ -336,9 +323,8 @@ creates a new TableStyle object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -385,9 +371,8 @@ a customizable set of options — -

      -if name option is not provided. -

      +
      +

      if name option is not provided.

      @@ -411,14 +396,13 @@ if name option is not provided.
      # 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
      -
      +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 @@ -451,9 +435,8 @@ if name option is not provided.

      -

      -The name of this table style -

      + +

      The name of this table style

      @@ -487,10 +470,9 @@ The name of this table style
      # File 'lib/axlsx/stylesheet/table_style.rb', line 8
       
      -def name
      -  @name
      -end
      -
      +def name + @name +end @@ -508,9 +490,8 @@ The name of this table style

      -

      -indicates if this style should be applied to pivot tables -

      + +

      indicates if this style should be applied to pivot tables

      @@ -544,10 +525,9 @@ indicates if this style should be applied to pivot tables
      # File 'lib/axlsx/stylesheet/table_style.rb', line 12
       
      -def pivot
      -  @pivot
      -end
      -
      +def pivot + @pivot +end @@ -565,9 +545,8 @@ indicates if this style should be applied to pivot tables

      -

      -indicates if this style should be applied to tables -

      + +

      indicates if this style should be applied to tables

      @@ -601,10 +580,9 @@ indicates if this style should be applied to tables
      # File 'lib/axlsx/stylesheet/table_style.rb', line 16
       
      -def table
      -  @table
      -end
      -
      +def table + @table +end @@ -626,9 +604,8 @@ indicates if this style should be applied to tables

      -

      -Serializes the table style -

      + +

      Serializes the table style

      @@ -647,9 +624,8 @@ Serializes the table style — -

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

      +
      +

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

      @@ -676,21 +652,20 @@ The document builder instance this objects xml will be added to.
       
       
      -38
      -39
      -40
       41
      -42
      +42 +43 +44 +45 -
      # 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
      -
      +
      # File 'lib/axlsx/stylesheet/table_style.rb', line 41
      +
      +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
      @@ -701,9 +676,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/TableStyleElement.html b/doc/Axlsx/TableStyleElement.html index 489c801c..3f4b41fe 100644 --- a/doc/Axlsx/TableStyleElement.html +++ b/doc/Axlsx/TableStyleElement.html @@ -6,7 +6,7 @@ Class: Axlsx::TableStyleElement - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
      Note: -

      -tables and table styles are not supported in this version. This class -exists in preparation for that support. -

      +
      +

      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. -

      + +

      an element of style that belongs to a table style.

      @@ -138,9 +136,8 @@ an element of style that belongs to a table style. -

      -The dxfId this style element points to. -

      +
      +

      The dxfId this style element points to.

      @@ -165,10 +162,9 @@ The dxfId this style element points to. -

      -Number of rows or columns used in striping when the type is firstRowStripe, -secondRowStripe, firstColumnStripe, or secondColumnStripe. -

      +
      +

      Number of rows or columns used in striping when the type is firstRowStripe, +secondRowStripe, firstColumnStripe, or secondColumnStripe.

      @@ -193,9 +189,8 @@ secondRowStripe, firstColumnStripe, or secondColumnStripe. -

      -The type of style element. -

      +
      +

      The type of style element.

      @@ -232,9 +227,8 @@ The type of style element. -

      -creates a new TableStyleElement object. -

      +
      +

      creates a new TableStyleElement object.

      @@ -256,9 +250,8 @@ creates a new TableStyleElement object. -

      -Serializes the table style element. -

      +
      +

      Serializes the table style element.

      @@ -279,9 +272,8 @@ Serializes the table style element.

      -

      -creates a new TableStyleElement object -

      + +

      creates a new TableStyleElement object

      @@ -302,9 +294,8 @@ creates a new TableStyleElement object — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -363,12 +354,11 @@ a customizable set of options
      # 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
      -
      +def initialize(options={}) + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] + end +end @@ -391,9 +381,8 @@ a customizable set of options

      -

      -The dxfId this style element points to -

      + +

      The dxfId this style element points to

      @@ -427,10 +416,9 @@ The dxfId this style element points to
      # File 'lib/axlsx/stylesheet/table_style_element.rb', line 43
       
      -def dxfId
      -  @dxfId
      -end
      -
      +def dxfId + @dxfId +end @@ -448,10 +436,9 @@ The dxfId this style element points to

      -

      -Number of rows or columns used in striping when the type is firstRowStripe, -secondRowStripe, firstColumnStripe, or secondColumnStripe. -

      + +

      Number of rows or columns used in striping when the type is firstRowStripe, +secondRowStripe, firstColumnStripe, or secondColumnStripe.

      @@ -485,10 +472,9 @@ secondRowStripe, firstColumnStripe, or secondColumnStripe.
      # File 'lib/axlsx/stylesheet/table_style_element.rb', line 39
       
      -def size
      -  @size
      -end
      -
      +def size + @size +end @@ -506,39 +492,37 @@ secondRowStripe, firstColumnStripe, or secondColumnStripe.

      -

      -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
      -
      + +

      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
      @@ -572,10 +556,9 @@ The type of style element. The following type are allowed
      # File 'lib/axlsx/stylesheet/table_style_element.rb', line 35
       
      -def type
      -  @type
      -end
      -
      +def type + @type +end @@ -597,9 +580,8 @@ The type of style element. The following type are allowed

      -

      -Serializes the table style element -

      + +

      Serializes the table style element

      @@ -618,9 +600,8 @@ Serializes the table style element — -

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

      +
      +

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

      @@ -647,17 +628,16 @@ The document builder instance this objects xml will be added to.
       
       
      -62
      -63
      -64
      +67 +68 +69 -
      # File 'lib/axlsx/stylesheet/table_style_element.rb', line 62
      +      
      # File 'lib/axlsx/stylesheet/table_style_element.rb', line 67
       
      -def to_xml(xml)
      -  xml.tableStyleElement self.instance_values
      -end
      -
      +def to_xml(xml) + xml.tableStyleElement self.instance_values +end
      @@ -668,9 +648,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/TableStyles.html b/doc/Axlsx/TableStyles.html index 47ff1ffe..0afdbba1 100644 --- a/doc/Axlsx/TableStyles.html +++ b/doc/Axlsx/TableStyles.html @@ -6,7 +6,7 @@ Class: Axlsx::TableStyles - — Documentation by YARD 0.7.3 + — AXLSX @@ -99,18 +99,16 @@
      Note: -

      -Support for custom table styles does not exist in this version. Many of the +

      +

      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. -

      +not attempt to add custom table styles.

      -

      -TableStyles represents a collection of style definitions for table styles -and pivot table styles. -

      + +

      TableStyles represents a collection of style definitions for table styles +and pivot table styles.

      @@ -146,9 +144,8 @@ and pivot table styles. -

      -The default pivot table style. -

      +
      +

      The default pivot table style.

      @@ -173,9 +170,8 @@ The default pivot table style. -

      -The default table style. -

      +
      +

      The default table style.

      @@ -220,10 +216,9 @@ The default table style. -

      -Creates a new TableStyles object that is a container for TableStyle -objects. -

      +
      +

      Creates a new TableStyles object that is a container for TableStyle +objects.

      @@ -245,9 +240,8 @@ objects. -

      -Serializes the table styles element. -

      +
      +

      Serializes the table styles element.

      @@ -261,12 +255,7 @@ Serializes the table styles element. - - - -

      Methods inherited from SimpleTypedList

      -

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

      -
      +

      Constructor Details

      @@ -278,9 +267,8 @@ Serializes the table styles element.

      -

      -Creates a new TableStyles object that is a container for TableStyle objects -

      + +

      Creates a new TableStyles object that is a container for TableStyle objects

      @@ -301,9 +289,8 @@ Creates a new TableStyles object that is a container for TableStyle objects — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -344,21 +331,20 @@ a customizable set of options
       
       
      +17
       18
       19
       20
      -21
      -22
      +21 -
      # File 'lib/axlsx/stylesheet/table_styles.rb', line 18
      -
      -def initialize(options={})
      -  @defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
      -  @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"      
      -  super TableStyle
      -end
      -
      +
      # File 'lib/axlsx/stylesheet/table_styles.rb', line 17
      +
      +def initialize(options={})
      +  @defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
      +  @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"      
      +  super TableStyle
      +end
      @@ -391,10 +377,8 @@ a customizable set of options

      -

      -The default pivot table style. The default value is -‘PivotStyleLight6’ -

      + +

      The default pivot table style. The default value is 'PivotStyleLight6'

      @@ -421,17 +405,16 @@ The default pivot table style. The default value is
       
       
      +12
       13
      -14
      -15
      +14 -
      # File 'lib/axlsx/stylesheet/table_styles.rb', line 13
      +      
      # File 'lib/axlsx/stylesheet/table_styles.rb', line 12
       
      -def defaultPivotStyle
      -  @defaultPivotStyle
      -end
      -
      +def defaultPivotStyle + @defaultPivotStyle +end
      @@ -449,10 +432,8 @@ The default pivot table style. The default value is

      -

      -The default table style. The default value is -‘TableStyleMedium9’ -

      + +

      The default table style. The default value is 'TableStyleMedium9'

      @@ -479,17 +460,16 @@ The default table style. The default value is
       
       
      +8
       9
      -10
      -11
      +10 -
      # File 'lib/axlsx/stylesheet/table_styles.rb', line 9
      +      
      # File 'lib/axlsx/stylesheet/table_styles.rb', line 8
       
      -def defaultTableStyle
      -  @defaultTableStyle
      -end
      -
      +def defaultTableStyle + @defaultTableStyle +end
      @@ -511,9 +491,8 @@ The default table style. The default value is

      -

      -Serializes the table styles element -

      + +

      Serializes the table styles element

      @@ -532,9 +511,8 @@ Serializes the table styles element — -

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

      +
      +

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

      @@ -572,14 +550,13 @@ The document builder instance this objects xml will be added to.
      # 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
      -
      +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 @@ -590,9 +567,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Title.html b/doc/Axlsx/Title.html index 1e38aab7..a9d6c7c5 100644 --- a/doc/Axlsx/Title.html +++ b/doc/Axlsx/Title.html @@ -6,7 +6,7 @@ Class: Axlsx::Title - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

      -A Title stores information about the title of a chart -

      + +

      A Title stores information about the title of a chart

      @@ -132,9 +131,8 @@ A Title stores information about the title of a chart -

      -The cell that holds the text for the title. -

      +
      +

      The cell that holds the text for the title.

      @@ -159,9 +157,8 @@ The cell that holds the text for the title. -

      -The text to be shown. -

      +
      +

      The text to be shown.

      @@ -198,34 +195,8 @@ The text to be shown. -

      -Creates a new Title object. -

      -
      - - - - -
    • - - - - (String) range - - - - - - - - - - - - -

      -returns the excel style abslute reference for the title when title is a -Cell object. -

      +
      +

      Creates a new Title object.

    • @@ -247,9 +218,8 @@ Cell object. -

      -Serializes the chart title. -

      +
      +

      Serializes the chart title.

      @@ -270,9 +240,8 @@ Serializes the chart title.

      -

      -Creates a new Title object -

      + +

      Creates a new Title object

      @@ -293,9 +262,8 @@ Creates a new Title object — -

      -The cell or string to be used for the chart’s title -

      +
      +

      The cell or string to be used for the chart's title

      @@ -317,11 +285,10 @@ The cell or string to be used for the chart’s title
      # 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
      -
      +def initialize(title="") + self.cell = title if title.is_a?(Cell) + self.text = title.to_s unless title.is_a?(Cell) +end @@ -344,10 +311,9 @@ The cell or string to be used for the chart’s title

      -

      -The cell that holds the text for the title. Setting this property will -automatically update the text attribute. -

      + +

      The cell that holds the text for the title. Setting this property will +automatically update the text attribute.

      @@ -381,10 +347,9 @@ automatically update the text attribute.
      # File 'lib/axlsx/drawing/title.rb', line 11
       
      -def cell
      -  @cell
      -end
      -
      +def cell + @cell +end @@ -402,10 +367,9 @@ automatically update the text attribute.

      -

      -The text to be shown. Setting this property directly with a string will -remove the cell reference. -

      + +

      The text to be shown. Setting this property directly with a string will +remove the cell reference.

      @@ -439,10 +403,9 @@ remove the cell reference.
      # File 'lib/axlsx/drawing/title.rb', line 7
       
      -def text
      -  @text
      -end
      -
      +def text + @text +end @@ -456,64 +419,7 @@ remove the cell reference.
      -

      - - - (String) range - - - -

      -
      -

      -returns the excel style abslute reference for the title when title is a -Cell object -

      - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (String) - - - -
      • - -
      - -
      - - - - -
      -
      -
      -
      -62
      -63
      -64
      -65
      -
      -
      # File 'lib/axlsx/drawing/title.rb', line 62
      -
      -def range
      -  return "" unless @data.is_a?(Cell)
      -  "#{@data.row.worksheet.name}!#{data.row.r_abs}"
      -end
      -
      -
      -
      - -
      -

      +

      - (String) to_xml(xml) @@ -521,9 +427,8 @@ Cell object

      -

      -Serializes the chart title -

      + +

      Serializes the chart title

      @@ -542,9 +447,8 @@ Serializes the chart title — -

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

      +
      +

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

      @@ -571,8 +475,6 @@ The document builder instance this objects xml will be added to.
       
       
      -42
      -43
       44
       45
       46
      @@ -585,27 +487,28 @@ The document builder instance this objects xml will be added to.
       53
       54
       55
      -56
      +56 +57 +58 -
      # File 'lib/axlsx/drawing/title.rb', line 42
      -
      -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
      -
      +
      # File 'lib/axlsx/drawing/title.rb', line 44
      +
      +def to_xml(xml)
      +  xml.send('c:title') {
      +    xml.send('c:tx') {
      +      xml.send('c:strRef') {
      +        xml.send('c:f', Axlsx::cell_range([@cell]))
      +        xml.send('c:strCache') {
      +          xml.send('c:ptCount', :val=>1)
      +          xml.send('c:pt', :idx=>0) {
      +            xml.send('c:v', @text)
      +          }
      +        }
      +      }
      +    }
      +  }      
      +end
      @@ -616,9 +519,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/TwoCellAnchor.html b/doc/Axlsx/TwoCellAnchor.html index 07adaac8..8e2b5d7c 100644 --- a/doc/Axlsx/TwoCellAnchor.html +++ b/doc/Axlsx/TwoCellAnchor.html @@ -6,7 +6,7 @@ Class: Axlsx::TwoCellAnchor - — Documentation by YARD 0.7.3 + — AXLSX @@ -97,16 +97,14 @@
      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. -

      +
      +

      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. -

      + +

      This class details the anchor points for drawings.

      @@ -145,9 +143,8 @@ This class details the anchor points for drawings. -

      -The drawing that holds this anchor. -

      +
      +

      The drawing that holds this anchor.

      @@ -172,9 +169,8 @@ The drawing that holds this anchor. -

      -A marker that defines the from cell anchor. -

      +
      +

      A marker that defines the from cell anchor.

      @@ -183,7 +179,7 @@ A marker that defines the from cell anchor.
    • - - (Integer) index + - (Pic, GraphicFrame) object @@ -199,9 +195,8 @@ A marker that defines the from cell anchor. -

      -The index of this anchor in the drawing. -

      +
      +

      The object this anchor hosts.

    • @@ -210,7 +205,7 @@ The index of this anchor in the drawing.
    • - - (Pic, GraphicFrame) object + - (Marker) to @@ -226,58 +221,53 @@ The index of this anchor in the drawing. -

      -The object this anchor hosts. -

      +
      +

      A marker that returns the to cell anchor.

    • -
    • +
    + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (Chart) add_chart(chart_type, options) + - (Integer) index @@ -290,9 +280,8 @@ A marker that returns the to cell anchor. -

      -Creates a graphic frame and chart object associated with this anchor. -

      +
      +

      The index of this anchor in the drawing.

    • @@ -316,10 +305,9 @@ Creates a graphic frame and chart object associated with this anchor. -

      -Creates a new TwoCellAnchor object and sets up a reference to the from and -to markers in the graphic_frame’s chart. -

      +
      +

      Creates a new TwoCellAnchor object and sets up a reference to the from and +to markers in the graphic_frame's chart.

      @@ -341,9 +329,8 @@ to markers in the graphic_frame’s chart. -

      -Serializes the two cell anchor. -

      +
      +

      Serializes the two cell anchor.

      @@ -367,17 +354,15 @@ Serializes the two cell anchor.
      Note: -

      -the chart_type parameter will be replaced with object in v. 2.0.0 -

      +
      +

      the chart_type parameter will be replaced with object in v. 2.0.0

      -

      -Creates a new TwoCellAnchor object and sets up a reference to the from and -to markers in the graphic_frame’s chart. That means that you can do -stuff like c = worksheet.add_chart Axlsx::Chart c.start_at 5, 9 -

      + +

      Creates a new TwoCellAnchor object and sets up a reference to the from and +to markers in the graphic_frame's chart. That means that you can do stuff +like c = worksheet.add_chart Axlsx::Chart c.start_at 5, 9

      @@ -407,10 +392,9 @@ stuff like c = worksheet.add_chart Axlsx::Chart c.start_at 5, 9 — -

      -This is passed to the graphic frame for instantiation. must be Chart or a -subclass of Chart -

      +
      +

      This is passed to the graphic frame for instantiation. must be Chart or a +subclass of Chart

      @@ -425,9 +409,8 @@ subclass of Chart — -

      -The object this anchor holds. -

      +
      +

      The object this anchor holds.

      @@ -444,9 +427,8 @@ The object this anchor holds. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -467,9 +449,8 @@ a customizable set of options - —

      -the col, row to start at -

      + —
      +

      the col, row to start at

      @@ -479,9 +460,8 @@ the col, row to start at - —

      -the col, row to end at -

      + —
      +

      the col, row to end at

      @@ -495,21 +475,20 @@ the col, row to end at
       
       
      +38
      +39
      +40
       41
      -42
      -43
      -44
      -45
      +42 -
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 41
      -
      -def initialize(drawing, options={})
      -  @drawing = drawing
      -  drawing.anchors << self      
      -  @from, @to =  Marker.new, Marker.new(:col => 5, :row=>10)
      -end
      -
      +
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 38
      +
      +def initialize(drawing, options={})
      +  @drawing = drawing
      +  drawing.anchors << self      
      +  @from, @to =  Marker.new, Marker.new(:col => 5, :row=>10)
      +end
      @@ -532,9 +511,8 @@ the col, row to end at

      -

      -The drawing that holds this anchor -

      + +

      The drawing that holds this anchor

      @@ -568,10 +546,9 @@ The drawing that holds this anchor
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 25
       
      -def drawing
      -  @drawing
      -end
      -
      +def drawing + @drawing +end @@ -589,10 +566,9 @@ The drawing that holds this anchor

      -

      -A marker that defines the from cell anchor. The default from column and row -are 0 and 0 respectively -

      + +

      A marker that defines the from cell anchor. The default from column and row +are 0 and 0 respectively

      @@ -626,10 +602,9 @@ are 0 and 0 respectively
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 9
       
      -def from
      -  @from
      -end
      -
      +def from + @from +end @@ -637,19 +612,18 @@ are 0 and 0 respectively - +
      -

      +

      - - (Integer) index (readonly) + - (Pic, GraphicFrame) object (readonly)

      -

      -The index of this anchor in the drawing -

      + +

      The object this anchor hosts

      @@ -662,7 +636,7 @@ The index of this anchor in the drawing
    • - (Integer) + (Pic, GraphicFrame) @@ -676,17 +650,16 @@ The index of this anchor in the drawing
       
       
      -29
      -30
      -31
      +21 +22 +23 -
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 29
      +      
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 21
       
      -def index
      -  @drawing.anchors.index(self)
      -end
      -
      +def object + @object +end
      @@ -694,19 +667,19 @@ The index of this anchor in the drawing - +
      -

      +

      - - (Pic, GraphicFrame) object (readonly) + - (Marker) to (readonly)

      -

      -The object this anchor hosts -

      + +

      A marker that returns the to cell anchor. The default to column and row are +5 and 10 respectively

      @@ -719,7 +692,7 @@ The object this anchor hosts
    • - (Pic, GraphicFrame) + (Marker) @@ -733,38 +706,39 @@ The object this anchor hosts
       
       
      -21
      -22
      -23
      +12 +13 +14 -
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 21
      +      
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 12
       
      -def object
      -  @object
      -end
      -
      +def to + @to +end
    • - - - -
      -

      +

      + + +
      +

      Instance Method Details

      + + +
      +

      - - (Marker) to (readonly) + - (Chart) add_chart(chart_type, options)

      -

      -A marker that returns the to cell anchor. The default to column and row are -5 and 10 respectively -

      + +

      Creates a graphic frame and chart object associated with this anchor

      @@ -777,7 +751,7 @@ A marker that returns the to cell anchor. The default to column and row are
    • - (Marker) + (Chart) @@ -791,41 +765,34 @@ A marker that returns the to cell anchor. The default to column and row are
       
       
      -12
      -13
      -14
      +46 +47 +48 +49 -
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 12
      +      
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 46
       
      -def to
      -  @to
      -end
      -
      +def add_chart(chart_type, options) + @object = GraphicFrame.new(self, chart_type, options) + @object.chart +end
    • -
      - - -
      -

      Instance Method Details

      - - -
      -

      +

      +

      - - (Chart) add_chart(chart_type, options) + - (Integer) index

      -

      -Creates a graphic frame and chart object associated with this anchor -

      + +

      The index of this anchor in the drawing

      @@ -838,7 +805,7 @@ Creates a graphic frame and chart object associated with this anchor
    • - (Chart) + (Integer) @@ -852,19 +819,16 @@ Creates a graphic frame and chart object associated with this anchor
       
       
      -49
      -50
      -51
      -52
      +53 +54 +55 -
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 49
      +      
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 53
       
      -def add_chart(chart_type, options)      
      -  @object = GraphicFrame.new(self, chart_type, options)
      -  @object.chart
      -end
      -
      +def index + @drawing.anchors.index(self) +end
      @@ -879,9 +843,8 @@ Creates a graphic frame and chart object associated with this anchor

      -

      -Serializes the two cell anchor -

      + +

      Serializes the two cell anchor

      @@ -900,9 +863,8 @@ Serializes the two cell anchor — -

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

      +
      +

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

    • @@ -929,6 +891,7 @@ The document builder instance this objects xml will be added to.
       
       
      +59
       60
       61
       62
      @@ -940,26 +903,24 @@ The document builder instance this objects xml will be added to.
       68
       69
       70
      -71
      -72
      +71 -
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 60
      -
      -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)
      -    }
      -    @object.to_xml(xml)
      -    xml.send('xdr:clientData')
      -  }
      -end
      -
      +
      # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 59
      +
      +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)
      +    }
      +    @object.to_xml(xml)
      +    xml.send('xdr:clientData')
      +  }
      +end
      @@ -970,9 +931,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/ValAxis.html b/doc/Axlsx/ValAxis.html index ca87efb1..252c78df 100644 --- a/doc/Axlsx/ValAxis.html +++ b/doc/Axlsx/ValAxis.html @@ -6,7 +6,7 @@ Class: Axlsx::ValAxis - — Documentation by YARD 0.7.3 + — AXLSX @@ -96,9 +96,8 @@

      Overview

      -

      -the ValAxis class defines a chart value axis. -

      + +

      the ValAxis class defines a chart value axis.

      @@ -134,9 +133,8 @@ the ValAxis class defines a chart value axis. -

      -This element specifies how the value axis crosses the category axis. -

      +
      +

      This element specifies how the value axis crosses the category axis.

      @@ -181,9 +179,8 @@ This element specifies how the value axis crosses the category axis. -

      -Creates a new ValAxis object. -

      +
      +

      Creates a new ValAxis object.

      @@ -205,9 +202,8 @@ Creates a new ValAxis object. -

      -Serializes the value axis. -

      +
      +

      Serializes the value axis.

      @@ -233,9 +229,8 @@ Serializes the value axis.

      -

      -Creates a new ValAxis object -

      + +

      Creates a new ValAxis object

      @@ -254,9 +249,8 @@ Creates a new ValAxis object — -

      -the id of this axis -

      +
      +

      the id of this axis

      @@ -271,9 +265,8 @@ the id of this axis — -

      -the id of the perpendicular axis -

      +
      +

      the id of the perpendicular axis

      @@ -290,9 +283,8 @@ the id of the perpendicular axis — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -363,11 +355,10 @@ a customizable set of options
      # File 'lib/axlsx/drawing/val_axis.rb', line 17
       
      -def initialize(axId, crossAx, options={})
      -  self.crossBetween = :between
      -  super(axId, crossAx, options)
      -end
      -
      +def initialize(axId, crossAx, options={}) + self.crossBetween = :between + super(axId, crossAx, options) +end @@ -390,10 +381,9 @@ a customizable set of options

      -

      -This element specifies how the value axis crosses the category axis. must -be one of [:between, :midCat] -

      + +

      This element specifies how the value axis crosses the category axis. must +be one of [:between, :midCat]

      @@ -427,10 +417,9 @@ be one of [:between, :midCat]
      # File 'lib/axlsx/drawing/val_axis.rb', line 8
       
      -def crossBetween
      -  @crossBetween
      -end
      -
      +def crossBetween + @crossBetween +end @@ -452,9 +441,8 @@ be one of [:between, :midCat]

      -

      -Serializes the value axis -

      + +

      Serializes the value axis

      @@ -473,9 +461,8 @@ Serializes the value axis — -

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

      +
      +

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

      @@ -512,13 +499,12 @@ The document builder instance this objects xml will be added to.
      # 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
      -
      +def to_xml(xml) + xml.send('c:valAx') { + super(xml) + xml.send('c:crossBetween', :val=>@crossBetween) + } +end @@ -529,9 +515,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/ValAxisData.html b/doc/Axlsx/ValAxisData.html index a4e30dd3..06cae71d 100644 --- a/doc/Axlsx/ValAxisData.html +++ b/doc/Axlsx/ValAxisData.html @@ -6,7 +6,7 @@ Class: Axlsx::ValAxisData - — Documentation by YARD 0.7.3 + — AXLSX @@ -98,9 +98,8 @@

      Overview

      -

      -The ValAxisData class manages the values for a chart value series. -

      + +

      The ValAxisData class manages the values for a chart value series.

      @@ -156,9 +155,8 @@ The ValAxisData class manages the values for a chart value series. -

      -Serializes the value axis data. -

      +
      +

      Serializes the value axis data.

      @@ -182,12 +180,7 @@ Serializes the value axis data. - - - -

      Methods inherited from SimpleTypedList

      -

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

      -
      +

      Constructor Details

      This class inherits a constructor from Axlsx::CatAxisData

      @@ -218,9 +211,8 @@ Serializes the value axis data.

      -

      -Serializes the value axis data -

      + +

      Serializes the value axis data

      @@ -239,9 +231,8 @@ Serializes the value axis data — -

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

      +
      +

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

      @@ -289,24 +280,23 @@ The document builder instance this objects xml will be added to.
      # File 'lib/axlsx/drawing/val_axis_data.rb', line 8
       
      -def to_xml(xml)
      -  xml.send('c:val') {
      -    xml.send('c:numRef') {
      -      xml.send('c:f', Axlsx::cell_range(@list))
      -      xml.send('c:numCache') {
      -        xml.send('c:formatCode', 'General')
      -        xml.send('c:ptCount', :val=>size)
      -        each_with_index do |item, index|
      -          v = item.is_a?(Cell) ? item.value : item
      -          xml.send('c:pt', :idx=>index) {
      -            xml.send('c:v', v) 
      -          }
      -        end
      -      }                        
      -    }
      -  }
      -end
      -
      +def to_xml(xml) + xml.send('c:val') { + xml.send('c:numRef') { + xml.send('c:f', Axlsx::cell_range(@list)) + xml.send('c:numCache') { + xml.send('c:formatCode', 'General') + xml.send('c:ptCount', :val=>size) + each_with_index do |item, index| + v = item.is_a?(Cell) ? item.value : item + xml.send('c:pt', :idx=>index) { + xml.send('c:v', v) + } + end + } + } + } +end @@ -317,9 +307,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/View3D.html b/doc/Axlsx/View3D.html index 67681d0c..d884bc39 100644 --- a/doc/Axlsx/View3D.html +++ b/doc/Axlsx/View3D.html @@ -6,7 +6,7 @@ Class: Axlsx::View3D - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

      -3D attributes for a chart. -

      + +

      3D attributes for a chart.

      @@ -112,9 +111,8 @@
      H_PERCENT_REGEX =
      -

      -Validation for hPercent -

      + +

      Validation for hPercent

      @@ -124,15 +122,13 @@ Validation for hPercent
      -
      /0*(([5-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
      -
      +
      /0*(([5-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
      DEPTH_PERCENT_REGEX =
      -

      -validation for depthPercent -

      + +

      validation for depthPercent

      @@ -142,8 +138,7 @@ validation for depthPercent
      -
      /0*(([2-9][0-9])|([1-9][0-9][0-9])|(1[0-9][0-9][0-9])|2000)%/
      -
      +
      /0*(([2-9][0-9])|([1-9][0-9][0-9])|(1[0-9][0-9][0-9])|2000)%/
      @@ -171,9 +166,8 @@ validation for depthPercent -

      -depth or chart as % of chart width must be between 20% and 2000%. -

      +
      +

      depth or chart as % of chart width must be between 20% and 2000%.

      @@ -198,9 +192,8 @@ depth or chart as % of chart width must be between 20% and 2000%. -

      -height of chart as % of chart must be between 5% and 500%. -

      +
      +

      height of chart as % of chart must be between 5% and 500%.

      @@ -225,9 +218,8 @@ height of chart as % of chart must be between 5% and 500%. -

      -field of view angle. -

      +
      +

      field of view angle.

      @@ -252,9 +244,8 @@ field of view angle. -

      -Chart axis are at right angles. -

      +
      +

      Chart axis are at right angles.

      @@ -279,9 +270,8 @@ Chart axis are at right angles. -

      -x rotation for the chart must be between -90 and 90. -

      +
      +

      x rotation for the chart must be between -90 and 90.

      @@ -306,9 +296,8 @@ x rotation for the chart must be between -90 and 90. -

      -y rotation for the chart must be between 0 and 360. -

      +
      +

      y rotation for the chart must be between 0 and 360.

      @@ -345,9 +334,8 @@ y rotation for the chart must be between 0 and 360. -

      -Creates a new View3D for charts. -

      +
      +

      Creates a new View3D for charts.

      @@ -369,9 +357,8 @@ Creates a new View3D for charts. -

      -Serializes the view3D properties. -

      +
      +

      Serializes the view3D properties.

      @@ -392,9 +379,8 @@ Serializes the view3D properties.

      -

      -Creates a new View3D for charts -

      + +

      Creates a new View3D for charts

      @@ -415,9 +401,8 @@ Creates a new View3D for charts — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -498,17 +483,18 @@ a customizable set of options 47 48 49 -50 +50 +51
      # File 'lib/axlsx/drawing/view_3D.rb', line 46
       
      -def initialize(options={})
      -  options.each do |o|
      -    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      -  end    
      -end
      -
      +def initialize(options={}) + @rotX, @hPercent, @rotY, @depthPercent, @rAngAx, @perspective = nil, nil, nil, nil, nil, nil + options.each do |o| + self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" + end +end @@ -531,9 +517,8 @@ a customizable set of options

      -

      -depth or chart as % of chart width must be between 20% and 2000% -

      + +

      depth or chart as % of chart width must be between 20% and 2000%

      @@ -567,10 +552,9 @@ depth or chart as % of chart width must be between 20% and 2000%
      # File 'lib/axlsx/drawing/view_3D.rb', line 29
       
      -def depthPercent
      -  @depthPercent
      -end
      -
      +def depthPercent + @depthPercent +end @@ -588,9 +572,8 @@ depth or chart as % of chart width must be between 20% and 2000%

      -

      -height of chart as % of chart must be between 5% and 500% -

      + +

      height of chart as % of chart must be between 5% and 500%

      @@ -624,10 +607,9 @@ height of chart as % of chart must be between 5% and 500%
      # File 'lib/axlsx/drawing/view_3D.rb', line 19
       
      -def hPercent
      -  @hPercent
      -end
      -
      +def hPercent + @hPercent +end @@ -645,9 +627,8 @@ height of chart as % of chart must be between 5% and 500%

      -

      -field of view angle -

      + +

      field of view angle

      @@ -681,10 +662,9 @@ field of view angle
      # File 'lib/axlsx/drawing/view_3D.rb', line 37
       
      -def perspective
      -  @perspective
      -end
      -
      +def perspective + @perspective +end @@ -702,9 +682,8 @@ field of view angle

      -

      -Chart axis are at right angles -

      + +

      Chart axis are at right angles

      @@ -738,10 +717,9 @@ Chart axis are at right angles
      # File 'lib/axlsx/drawing/view_3D.rb', line 33
       
      -def rAngAx
      -  @rAngAx
      -end
      -
      +def rAngAx + @rAngAx +end @@ -759,9 +737,8 @@ Chart axis are at right angles

      -

      -x rotation for the chart must be between -90 and 90 -

      + +

      x rotation for the chart must be between -90 and 90

      @@ -795,10 +772,9 @@ x rotation for the chart must be between -90 and 90
      # File 'lib/axlsx/drawing/view_3D.rb', line 14
       
      -def rotX
      -  @rotX
      -end
      -
      +def rotX + @rotX +end @@ -816,9 +792,8 @@ x rotation for the chart must be between -90 and 90

      -

      -y rotation for the chart must be between 0 and 360 -

      + +

      y rotation for the chart must be between 0 and 360

      @@ -852,10 +827,9 @@ y rotation for the chart must be between 0 and 360
      # File 'lib/axlsx/drawing/view_3D.rb', line 24
       
      -def rotY
      -  @rotY
      -end
      -
      +def rotY + @rotY +end @@ -877,9 +851,8 @@ y rotation for the chart must be between 0 and 360

      -

      -Serializes the view3D properties -

      + +

      Serializes the view3D properties

      @@ -898,9 +871,8 @@ Serializes the view3D properties — -

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

      +
      +

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

      @@ -927,31 +899,30 @@ The document builder instance this objects xml will be added to.
       
       
      -67
      -68
      -69
      -70
      -71
      -72
      -73
       74
       75
      -76
      +76 +77 +78 +79 +80 +81 +82 +83 -
      # File 'lib/axlsx/drawing/view_3D.rb', line 67
      -
      -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
      -
      +
      # File 'lib/axlsx/drawing/view_3D.rb', line 74
      +
      +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
      @@ -962,9 +933,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/Axlsx/Workbook.html b/doc/Axlsx/Workbook.html index f1e19bd0..69e4e8e0 100644 --- a/doc/Axlsx/Workbook.html +++ b/doc/Axlsx/Workbook.html @@ -6,7 +6,7 @@ Class: Axlsx::Workbook - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,33 +94,31 @@

      Overview

      -

      -The Workbook class is an xlsx workbook that manages worksheets, charts, + +

      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
      -
      +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
      @@ -136,10 +134,9 @@ specification are not implimented in this version.
      @@date1904 =
      -

      -Indicates if the epoc date for serialization should be 1904. If false, 1900 -is used. -

      + +

      Indicates if the epoc date for serialization should be 1904. If false, 1900 +is used.

      @@ -149,8 +146,7 @@ is used.
      -
      false
      -
      +
      false
      @@ -178,9 +174,8 @@ is used. -

      -A colllection of charts associated with this workbook. -

      +
      +

      A colllection of charts associated with this workbook.

      @@ -189,14 +184,14 @@ A colllection of charts associated with this workbook.
    • - - (Boolean) date1904 + - (SimpleTypedList) drawings - + readonly @@ -205,9 +200,8 @@ A colllection of charts associated with this workbook. -

      -Instance level access to the class variable 1904. -

      +
      +

      A colllection of drawings associated with this workbook.

    • @@ -216,7 +210,7 @@ Instance level access to the class variable 1904.
    • - - (SimpleTypedList) drawings + - (SimpleTypedList) images @@ -232,9 +226,8 @@ Instance level access to the class variable 1904. -

      -A colllection of drawings associated with this workbook. -

      +
      +

      A colllection of images associated with this workbook.

    • @@ -243,7 +236,7 @@ A colllection of drawings associated with this workbook.
    • - - (SimpleTypedList) images + - (Styles) styles @@ -259,9 +252,8 @@ A colllection of drawings associated with this workbook. -

      -A colllection of images associated with this workbook. -

      +
      +

      The styles associated with this workbook.

    • @@ -270,7 +262,7 @@ A colllection of images associated with this workbook.
    • - - (Relationships) relationships + - (SimpleTypedList) worksheets @@ -286,76 +278,76 @@ A colllection of images associated with this workbook. -

      -The workbook relationships. -

      +
      +

      A collection of worksheets associated with this workbook.

    • -
    • +
    + + + + + +

    + Class Method Summary + (collapse) +

    + + - - - - + +

    - Class Method Summary + Instance Method Summary (collapse)

    @@ -364,7 +356,7 @@ A collection of worksheets associated with this workbook.
  • - + (Boolean) date1904 + - (Worksheet) add_worksheet(options = {}) {|worksheet| ... } @@ -377,9 +369,8 @@ A collection of worksheets associated with this workbook. -

    -retrieves the date1904 attribute. -

    +
    +

    Adds a worksheet to this workbook.

  • @@ -388,7 +379,7 @@ retrieves the date1904 attribute.
  • - + (Boolean) date1904=(v) + - (Boolean) date1904 @@ -401,27 +392,17 @@ retrieves the date1904 attribute. -

    -Sets the date1904 attribute to the provided boolean. -

    +
    +

    Instance level access to the class variable 1904.

  • - - -

    - Instance Method Summary - (collapse) -

    - -
      -
    • - - (Worksheet) add_worksheet(options = {}) {|worksheet| ... } + - (Object) date1904=(v) @@ -434,9 +415,8 @@ Sets the date1904 attribute to the provided boolean. -

      -Adds a worksheet to this workbook. -

      +
      +

      see @date1904.

    • @@ -460,9 +440,31 @@ Adds a worksheet to this workbook. -

      -Creates a new Workbook. -

      +
      +

      Creates a new Workbook.

      +
      + + + + +
    • + + + - (Relationships) relationships + + + + + + + + + + + + +
      +

      The workbook relationships.

    • @@ -484,9 +486,8 @@ Creates a new Workbook. -

      -Serializes the workbook document. -

      +
      +

      Serializes the workbook document.

      @@ -507,9 +508,8 @@ Serializes the workbook document.

      -

      -Creates a new Workbook -

      + +

      Creates a new Workbook

      @@ -530,9 +530,8 @@ Creates a new Workbook — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -583,9 +582,8 @@ a customizable set of options — -

      -the object that the method was called on -

      +
      +

      the object that the method was called on

      @@ -598,29 +596,28 @@ the object that the method was called on
       
       
      +75
      +76
      +77
      +78
      +79
      +80
      +81
       82
      -83
      -84
      -85
      -86
      -87
      -88
      -89
      -90
      +83 -
      # File 'lib/axlsx/workbook/workbook.rb', line 82
      -
      -def initialize(options={})
      -  @styles = Styles.new
      -  @worksheets = SimpleTypedList.new Worksheet
      -  @drawings = SimpleTypedList.new Drawing
      -  @charts = SimpleTypedList.new Chart
      -  @images = SimpleTypedList.new Pic
      -  self.date1904= options[:date1904] unless options[:date1904].nil?
      -  yield self if block_given?      
      -end
      -
      +
      # 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
      +  @images = SimpleTypedList.new Pic
      +  self.date1904= options[:date1904] unless options[:date1904].nil?
      +  yield self if block_given?      
      +end
      @@ -646,15 +643,13 @@ the object that the method was called on
      Note: -

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

      +
      +

      The recommended way to manage charts is Worksheet#add_chart

      -

      -A colllection of charts associated with this workbook -

      + +

      A colllection of charts associated with this workbook

      @@ -697,63 +692,9 @@ A colllection of charts associated with this workbook
      # File 'lib/axlsx/workbook/workbook.rb', line 45
       
      -def charts
      -  @charts
      -end
      -
      - - - -
      - - - - -
      -

      - - - (Boolean) date1904 - - - -

      -
      -

      -Instance level access to the class variable 1904 -

      - - -
      -
      -
      - -

      Returns:

      -
        - -
      • - - - (Boolean) - - - -
      • - -
      - -
      - - -
      -
      -
      -
      -74
      -
      -
      # File 'lib/axlsx/workbook/workbook.rb', line 74
      -
      -def date1904() @@date1904; end
      -
      +def charts + @charts +end
      @@ -774,15 +715,13 @@ Instance level access to the class variable 1904
      Note: -

      -The recommended way to manage drawings is Worksheet#add_chart -

      +
      +

      The recommended way to manage drawings is Worksheet#add_chart

      -

      -A colllection of drawings associated with this workbook -

      + +

      A colllection of drawings associated with this workbook

      @@ -825,10 +764,9 @@ A colllection of drawings associated with this workbook
      # File 'lib/axlsx/workbook/workbook.rb', line 59
       
      -def drawings
      -  @drawings
      -end
      -
      +def drawings + @drawings +end @@ -849,15 +787,13 @@ A colllection of drawings associated with this workbook
      Note: -

      -The recommended way to manage images is Worksheet#add_image -

      +
      +

      The recommended way to manage images is Worksheet#add_image

      -

      -A colllection of images associated with this workbook -

      + +

      A colllection of images associated with this workbook

      @@ -900,77 +836,9 @@ A colllection of images associated with this workbook
      # File 'lib/axlsx/workbook/workbook.rb', line 52
       
      -def images
      -  @images
      -end
      -
      - - - -
      - - - - -
      -

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

      -
      -

      -The workbook relationships. This is managed automatically by the workbook -

      - - -
      -
      -
      - -

      Returns:

      - - -
      - - -
      -
      -
      -
      -70
      -71
      -72
      -73
      -74
      -75
      -76
      -77
      -
      -
      # File 'lib/axlsx/workbook/workbook.rb', line 70
      -
      -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
      -
      +def images + @images +end
      @@ -991,15 +859,13 @@ The workbook relationships. This is managed automatically by the workbook
      Note: -

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

      +
      +

      The recommended way to manage styles is Styles#add_style

      -

      -The styles associated with this workbook -

      + +

      The styles associated with this workbook

      @@ -1042,10 +908,9 @@ The styles associated with this workbook
      # File 'lib/axlsx/workbook/workbook.rb', line 66
       
      -def styles
      -  @styles
      -end
      -
      +def styles + @styles +end @@ -1066,15 +931,13 @@ The styles associated with this workbook
      Note: -

      -The recommended way to manage worksheets is add_worksheet -

      +
      +

      The recommended way to manage worksheets is add_worksheet

      -

      -A collection of worksheets associated with this workbook. -

      + +

      A collection of worksheets associated with this workbook.

      @@ -1117,10 +980,9 @@ A collection of worksheets associated with this workbook.
      # File 'lib/axlsx/workbook/workbook.rb', line 38
       
      -def worksheets
      -  @worksheets
      -end
      -
      +def worksheets + @worksheets +end @@ -1142,9 +1004,8 @@ A collection of worksheets associated with this workbook.

      -

      -retrieves the date1904 attribute -

      + +

      retrieves the date1904 attribute

      @@ -1171,13 +1032,12 @@ retrieves the date1904 attribute
       
       
      -101
      +98 -
      # File 'lib/axlsx/workbook/workbook.rb', line 101
      +      
      # File 'lib/axlsx/workbook/workbook.rb', line 98
       
      -def self.date1904() @@date1904; end
      -
      +def self.date1904() @@date1904; end
      @@ -1192,9 +1052,8 @@ retrieves the date1904 attribute

      -

      -Sets the date1904 attribute to the provided boolean -

      + +

      Sets the date1904 attribute to the provided boolean

      @@ -1221,13 +1080,12 @@ Sets the date1904 attribute to the provided boolean
       
       
      -97
      +94 -
      # File 'lib/axlsx/workbook/workbook.rb', line 97
      +      
      # File 'lib/axlsx/workbook/workbook.rb', line 94
       
      -def self.date1904=(v) Axlsx::validate_boolean v; @@date1904 = v end
      -
      +def self.date1904=(v) Axlsx::validate_boolean v; @@date1904 = v; end
      @@ -1248,9 +1106,8 @@ Sets the date1904 attribute to the provided boolean

      -

      -Adds a worksheet to this workbook -

      + +

      Adds a worksheet to this workbook

      @@ -1271,9 +1128,8 @@ Adds a worksheet to this workbook — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -1292,9 +1148,8 @@ a customizable set of options - —

      -The name of the worksheet. -

      + —
      +

      The name of the worksheet.

      @@ -1341,21 +1196,165 @@ The name of the worksheet.
       
       
      +104
      +105
      +106
       107
      -108
      -109
      -110
      -111
      +108 + + +
      # File 'lib/axlsx/workbook/workbook.rb', line 104
      +
      +def add_worksheet(options={})
      +  worksheet = Worksheet.new(self, options)
      +  yield worksheet if block_given?
      +  worksheet
      +end
      + + + +
      + +
      +

      + + - (Boolean) date1904 + + + +

      +
      + +

      Instance level access to the class variable 1904

      + + +
      +
      +
      + +

      Returns:

      +
        + +
      • + + + (Boolean) + + + +
      • + +
      + +
      + + + + +
      +
      +
      +
      +87
      +
      +
      # File 'lib/axlsx/workbook/workbook.rb', line 87
      +
      +def date1904() @@date1904; end
      +
      +
      + +
      +

      + + - (Object) date1904=(v) + + + +

      +
      + +

      see @date1904

      + + +
      +
      +
      + + +
      + + + + +
      +
      +
      +
      +90
      +
      +
      # File 'lib/axlsx/workbook/workbook.rb', line 90
      +
      +def date1904=(v) Axlsx::validate_boolean v; @@date1904 = v; end
      +
      +
      + +
      +

      + + - (Relationships) relationships + + + +

      +
      + +

      The workbook relationships. This is managed automatically by the workbook

      + + +
      +
      +
      + +

      Returns:

      + + +
      + +
      +
      +
      +
      +112
      +113
      +114
      +115
      +116
      +117
      +118
      +119
      -
      # File 'lib/axlsx/workbook/workbook.rb', line 107
      -
      -def add_worksheet(options={})
      -  worksheet = Worksheet.new(self, options)
      -  yield worksheet if block_given?
      -  worksheet
      -end
      -
      +
      # File 'lib/axlsx/workbook/workbook.rb', line 112
      +
      +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
      @@ -1370,9 +1369,8 @@ The name of the worksheet.

      -

      -Serializes the workbook document -

      + +

      Serializes the workbook document

      @@ -1399,6 +1397,7 @@ Serializes the workbook document
       
       
      +123
       124
       125
       126
      @@ -1411,27 +1410,25 @@ Serializes the workbook document
       133
       134
       135
      -136
      -137
      +136 -
      # File 'lib/axlsx/workbook/workbook.rb', line 124
      -
      -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
      -
      +
      # File 'lib/axlsx/workbook/workbook.rb', line 123
      +
      +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
      @@ -1442,9 +1439,9 @@ Serializes the workbook document
      diff --git a/doc/Axlsx/Worksheet.html b/doc/Axlsx/Worksheet.html index 83359c16..db1e39f7 100644 --- a/doc/Axlsx/Worksheet.html +++ b/doc/Axlsx/Worksheet.html @@ -6,7 +6,7 @@ Class: Axlsx::Worksheet - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,8 @@

      Overview

      -

      -The Worksheet class represents a worksheet in the workbook. -

      + +

      The Worksheet class represents a worksheet in the workbook.

      @@ -128,9 +127,8 @@ The Worksheet class represents a worksheet in the workbook. -

      -An array of content based calculated column widths. -

      +
      +

      An array of content based calculated column widths.

      @@ -139,14 +137,14 @@ An array of content based calculated column widths.
    • - - (Drawing) drawing + - (String) name - readonly + @@ -155,9 +153,8 @@ An array of content based calculated column widths. -

      -The drawing associated with this worksheet. -

      +
      +

      The name of the worksheet.

    • @@ -166,7 +163,7 @@ The drawing associated with this worksheet.
    • - - (Integer) index + - (SimpleTypedList) rows @@ -182,9 +179,8 @@ The drawing associated with this worksheet. -

      -The index of this worksheet in the owning Workbook’s worksheets list. -

      +
      +

      The rows in this worksheet.

    • @@ -193,7 +189,7 @@ The index of this worksheet in the owning Workbook’s worksheets list.
    • - - (String) name + - (Workbook) workbook @@ -209,193 +205,122 @@ The index of this worksheet in the owning Workbook’s worksheets list. -

      -The name of the worksheet. -

      +
      +

      The workbook that owns this worksheet.

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

    -The part name of this worksheet. -

    -
    - - - -
  • - - - - (Object) relationships - - - - - - readonly - - - - - - -

    -The worksheet’s relationships. -

    -
    - -
  • +

    + Instance Method Summary + (collapse) +

    - -
  • + - - - - - -

    - Instance Method Summary - (collapse) -

    - -
    • - - (Object) add_chart(chart_type, options = {}) {|chart| ... } + - (Integer) index @@ -408,9 +333,8 @@ The workbook that owns this worksheet. -

      -Adds a chart to this worksheets drawing. -

      +
      +

      The index of this worksheet in the owning Workbook's worksheets list.

    • @@ -419,12 +343,14 @@ Adds a chart to this worksheets drawing.
    • - - (Object) add_image(options = {}) {|image| ... } + - (Worksheet) initialize(wb, options = {}) + constructor + @@ -432,9 +358,8 @@ Adds a chart to this worksheets drawing. -

      -Adds a media item to the worksheets drawing. -

      +
      +

      Creates a new worksheet.

    • @@ -443,7 +368,7 @@ Adds a media item to the worksheets drawing.
    • - - (Row) add_row(values = [], options = {}) {|@rows.last| ... } + - (String) pn @@ -456,9 +381,8 @@ Adds a media item to the worksheets drawing. -

      -Adds a row to the worksheet and updates auto fit data. -

      +
      +

      The part name of this worksheet.

    • @@ -467,7 +391,7 @@ Adds a row to the worksheet and updates auto fit data.
    • - - (Float) auto_width(col) + - (Relationships) relationships @@ -480,9 +404,8 @@ Adds a row to the worksheet and updates auto fit data. -

      -Determines the proper width for a column based on content. -

      +
      +

      The worksheet relationships.

    • @@ -491,14 +414,12 @@ Determines the proper width for a column based on content.
    • - - (Worksheet) initialize(wb, options = {}) + - (String) rels_pn - constructor - @@ -506,9 +427,8 @@ Determines the proper width for a column based on content. -

      -Creates a new worksheet. -

      +
      +

      The relationship part name of this worksheet.

    • @@ -517,7 +437,7 @@ Creates a new worksheet.
    • - - (String) to_xml + - (String) rId @@ -530,9 +450,8 @@ Creates a new worksheet. -

      -Serializes the worksheet document. -

      +
      +

      The relationship Id of thiw worksheet.

    • @@ -541,7 +460,7 @@ Serializes the worksheet document.
    • - - (Array) update_auto_fit_data(cells) + - (String) to_xml @@ -554,9 +473,8 @@ Serializes the worksheet document. -

      -Updates auto fit data. -

      +
      +

      Serializes the worksheet document.

    • @@ -580,15 +498,13 @@ Updates auto fit data.
      Note: -

      -the recommended way to manage worksheets is Workbook#add_worksheet -

      +
      +

      the recommended way to manage worksheets is Workbook#add_worksheet

      -

      -Creates a new worksheet. -

      + +

      Creates a new worksheet.

      @@ -609,9 +525,8 @@ Creates a new worksheet. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -632,9 +547,8 @@ a customizable set of options - —

      -The name of this sheet. -

      + —
      +

      The name of this sheet.

      @@ -655,417 +569,61 @@ The name of this sheet.
       
       
      -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) - - - -
      • - -
      - -
      - -
      -
      -
      -
      +36
      +37
       38
       39
      -40
      +40 +41 +42
      -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 38
      +      
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 34
       
      -def pn
      -  "#{WORKSHEET_PN % (index+1)}"
      -end
      -
      +def initialize(wb, options={}) + @drawing = nil + @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
      - - - - -
      -

      - - (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
      -
      -
      -
      +
      +

      Instance Attribute Details

      - -
      -

      + +

      +

      - - (String) rels_pn (readonly) + - (Array) auto_fit_data (readonly)

      -

      -The relationship part name of this worksheet -

      + +
      + 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.

      @@ -1078,9 +636,14 @@ The relationship part name of this worksheet
    • - (String) + (Array) + + — +
      +

      of Hash

      +
    • @@ -1092,37 +655,35 @@ The relationship part name of this worksheet
       
       
      -42
      -43
      -44
      +25 +26 +27 -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 42
      +      
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 25
       
      -def rels_pn
      -  "#{WORKSHEET_RELS_PN % (index+1)}"
      -end
      -
      +def auto_fit_data + @auto_fit_data +end
      - - + +
      -

      +

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

      -

      -The relationship Id of thiw worksheet -

      + +

      The name of the worksheet

      @@ -1149,17 +710,16 @@ The relationship Id of thiw worksheet
       
       
      -46
      -47
      -48
      +9 +10 +11 -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 46
      +      
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 9
       
      -def rId
      -  "rId#{index+1}"
      -end
      -
      +def name + @name +end
      @@ -1180,15 +740,13 @@ The relationship Id of thiw worksheet
      Note: -

      -The recommended way to manage rows is Worksheet#add_row -

      +
      +

      The recommended way to manage rows is Worksheet#add_row

      -

      -The rows in this worksheet -

      + +

      The rows in this worksheet

      @@ -1222,17 +780,16 @@ The rows in this worksheet
       
       
      -23
      -24
      -25
      +20 +21 +22 -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 23
      +      
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 20
       
      -def rows
      -  @rows
      -end
      -
      +def rows + @rows +end
      @@ -1250,9 +807,8 @@ The rows in this worksheet

      -

      -The workbook that owns this worksheet -

      + +

      The workbook that owns this worksheet

      @@ -1286,10 +842,9 @@ The workbook that owns this worksheet
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 13
       
      -def workbook
      -  @workbook
      -end
      -
      +def workbook + @workbook +end @@ -1314,18 +869,16 @@ The workbook that owns this worksheet
      Note: -

      -each chart type also specifies additional options -

      +
      +

      each chart type also specifies additional options

      -

      -Adds a chart to this worksheets drawing. This is the recommended way to + +

      Adds a chart to this worksheets drawing. This is the recommended way to create charts for your worksheet. This method wraps the complexity of dealing with ooxml drawing, anchors, markers graphic frames chart objects -and all the other dirty details. -

      +and all the other dirty details.

      @@ -1357,9 +910,8 @@ and all the other dirty details. — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -1457,21 +1009,20 @@ a customizable set of options
       
       
      -116
      -117
      -118
      -119
      -120
      +105 +106 +107 +108 +109 -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 116
      -
      -def add_chart(chart_type, options={})
      -  chart = drawing.add_chart(chart_type, options)
      -  yield chart if block_given?
      -  chart
      -end
      -
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 105
      +
      +def add_chart(chart_type, options={})
      +  chart = drawing.add_chart(chart_type, options)
      +  yield chart if block_given?
      +  chart
      +end
      @@ -1486,9 +1037,8 @@ a customizable set of options

      -

      -Adds a media item to the worksheets drawing -

      + +

      Adds a media item to the worksheets drawing

      @@ -1520,9 +1070,8 @@ Adds a media item to the worksheets drawing — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -1541,9 +1090,8 @@ a customizable set of options - —

      -unknown -

      + —
      +

      unknown

      @@ -1570,21 +1118,20 @@ unknown
       
       
      -125
      -126
      -127
      -128
      -129
      +114 +115 +116 +117 +118 -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 125
      -
      -def add_image(options={})
      -  image = drawing.add_image(options)
      -  yield image if block_given?
      -  image
      -end
      -
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 114
      +
      +def add_image(options={})
      +  image = drawing.add_image(options)
      +  yield image if block_given?
      +  image
      +end
      @@ -1599,9 +1146,8 @@ unknown

      -

      -Adds a row to the worksheet and updates auto fit data -

      + +

      Adds a row to the worksheet and updates auto fit data

      @@ -1622,9 +1168,8 @@ Adds a row to the worksheet and updates auto fit data — -

      -a customizable set of options -

      +
      +

      a customizable set of options

      @@ -1702,32 +1247,31 @@ a customizable set of options
       
       
      -96
      -97
      -98
      -99
      -100
      -101
      +85 +86 +87 +88 +89 +90 -
      # 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
      -
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 85
      +
      +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) + - (Drawing) drawing @@ -1736,54 +1280,137 @@ a customizable set of options

      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
      -
      +
      +

      the recommended way to work with drawings and charts is Worksheet#add_chart

      -

      -Determines the proper width for a column based on content. -

      + +

      The drawing associated with this worksheet.

      -

      Parameters:

      -
        + +

        Returns:

        +
        • - A - - (Hash) + (Drawing) - — -

          -hash of auto_fit_data -

          +
        • + +
        + +

        See Also:

        + + +
      + + + + +
      +
      +
      +
      +76
      +77
      +78
      +
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 76
      +
      +def drawing
      +  @drawing || @drawing = Axlsx::Drawing.new(self)
      +end
      +
      +
      + +
      +

      + + - (Integer) index + + + +

      +
      + +

      The index of this worksheet in the owning Workbook's worksheets list.

      + + +
      +
      + +

      Returns:

      +
        + +
      • + + + (Integer) + +
      +
      + + + + +
      +
      +
      +
      +68
      +69
      +70
      +
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 68
      +
      +def index
      +  @workbook.worksheets.index(self)
      +end
      +
      +
      + +
      +

      + + - (String) pn + + + +

      +
      + +

      The part name of this worksheet

      + + +
      +
      +
      +

      Returns:

      • - (Float) + (String) @@ -1797,48 +1424,32 @@ hash of auto_fit_data
         
         
        -199
        -200
        -201
        -202
        -203
        -204
        -205
        -206
        -207
        -208
        +50 +51 +52 -
        # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 199
        -
        -def auto_width(col)
        -  mdw = 6.0 # maximum digit with is always 6.0 with RMagick's default font
        -  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
        -
        +
        # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 50
        +
        +def pn
        +  "#{WORKSHEET_PN % (index+1)}"
        +end
      -

      +

      - - (String) to_xml + - (Relationships) relationships

      -

      -Serializes the worksheet document -

      + +

      The worksheet relationships. This is managed automatically by the worksheet

      @@ -1851,7 +1462,7 @@ Serializes the worksheet document
    • - (String) + (Relationships) @@ -1865,114 +1476,155 @@ Serializes the worksheet document
       
       
      -133
      -134
      -135
      -136
      -137
      -138
      -139
      -140
      -141
      -142
      -143
      -144
      -145
       146
       147
       148
       149
      -150
      -151
      -152
      -153
      +150 -
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 133
      -
      -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
      -
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 146
      +
      +def relationships
      +    r = Relationships.new
      +    r << Relationship.new(DRAWING_R, "../#{@drawing.pn}") if @drawing
      +    r
      +end
    • -

      +

      - - (Array) update_auto_fit_data(cells) + - (String) rels_pn

      -

      -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. -

      + +

      The relationship part name of this worksheet

      -

      Parameters:

      -
        + +

        Returns:

        +
        • - cells - - - (Array) + (String) - — -

          -an array of cells -

          -
        +
      + + + + +
      +
      +
      +
      +56
      +57
      +58
      +
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 56
      +
      +def rels_pn
      +  "#{WORKSHEET_RELS_PN % (index+1)}"
      +end
      +
      +
      + +
      +

      + + - (String) rId + + + +

      +
      + +

      The relationship Id of thiw worksheet

      + + +
      +
      +
      +

      Returns:

      • - (Array) + (String) - — -

        -of Cell objects -

        +
      • + +
      + +
      + + + + +
      +
      +
      +
      +62
      +63
      +64
      +
      +
      # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 62
      +
      +def rId
      +  "rId#{index+1}"
      +end
      +
      +
      + +
      +

      + + - (String) to_xml + + + +

      +
      + +

      Serializes the worksheet document

      + + +
      +
      + +

      Returns:

      +
        + +
      • + + + (String) + +
      • @@ -1984,49 +1636,52 @@ of Cell objects
         
         
        -171
        -172
        -173
        -174
        -175
        -176
        -177
        -178
        -179
        -180
        -181
        -182
        -183
        -184
        -185
        -186
        -187
        -188
        -189
        +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 -
        # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 171
        -
        -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
        -
        +
        # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 122
        +
        +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
        +end
        @@ -2037,9 +1692,9 @@ of Cell objects
      diff --git a/doc/Axlsx/Xf.html b/doc/Axlsx/Xf.html index 8e0d5d8b..b42932ab 100644 --- a/doc/Axlsx/Xf.html +++ b/doc/Axlsx/Xf.html @@ -6,7 +6,7 @@ Class: Axlsx::Xf - — Documentation by YARD 0.7.3 + — AXLSX @@ -94,9 +94,9 @@

      Overview

      -

      -The Xf class defines a formatting record for use in Styles -

      + +

      The Xf class defines a formatting record for use in Styles. The recommended +way to manage styles for your workbook is with Styles#add_style

      @@ -104,6 +104,13 @@ The Xf class defines a formatting record for use in Styles
      +

      See Also:

      + +

      Instance Attribute Summary (collapse)

      @@ -128,9 +135,8 @@ The Xf class defines a formatting record for use in Styles -

      -The cell alignment for this style. -

      +
      +

      The cell alignment for this style.

      @@ -155,9 +161,8 @@ The cell alignment for this style. -

      -Indicates if the alignment options should be applied. -

      +
      +

      Indicates if the alignment options should be applied.

      @@ -182,9 +187,8 @@ Indicates if the alignment options should be applied. -

      -indicates if the borderId should be applied. -

      +
      +

      indicates if the borderId should be applied.

      @@ -209,9 +213,8 @@ indicates if the borderId should be applied. -

      -indicates if the fillId should be applied. -

      +
      +

      indicates if the fillId should be applied.

      @@ -236,9 +239,8 @@ indicates if the fillId should be applied. -

      -indicates if the fontId should be applied. -

      +
      +

      indicates if the fontId should be applied.

      @@ -263,9 +265,8 @@ indicates if the fontId should be applied. -

      -indicates if the numFmtId should be applied. -

      +
      +

      indicates if the numFmtId should be applied.

      @@ -290,9 +291,8 @@ indicates if the numFmtId should be applied. -

      -Indicates if the protection options should be applied. -

      +
      +

      Indicates if the protection options should be applied.

      @@ -317,9 +317,8 @@ Indicates if the protection options should be applied. -

      -index (0 based) of the border to be used in this style. -

      +
      +

      index (0 based) of the border to be used in this style.

      @@ -344,9 +343,8 @@ index (0 based) of the border to be used in this style. -

      -index (0 based) of the fill to be used in this style. -

      +
      +

      index (0 based) of the fill to be used in this style.

      @@ -371,9 +369,8 @@ index (0 based) of the fill to be used in this style. -

      -index (0 based) of the font to be used in this style. -

      +
      +

      index (0 based) of the font to be used in this style.

      @@ -398,9 +395,8 @@ index (0 based) of the font to be used in this style. -

      -id of the numFmt to apply to this style. -

      +
      +

      id of the numFmt to apply to this style.

      @@ -425,9 +421,8 @@ id of the numFmt to apply to this style. -

      -indicates if the cell has a pivot table drop down button. -

      +
      +

      indicates if the cell has a pivot table drop down button.

      @@ -452,9 +447,8 @@ indicates if the cell has a pivot table drop down button. -

      -The cell protection for this style. -

      +
      +

      The cell protection for this style.

      @@ -479,9 +473,8 @@ The cell protection for this style. -

      -indecates if text should be prefixed by a single quote in the cell. -

      +
      +

      indecates if text should be prefixed by a single quote in the cell.

      @@ -506,9 +499,8 @@ indecates if text should be prefixed by a single quote in the cell. -

      -index (0 based) of cellStylesXfs item to be used in this style. -

      +
      +

      index (0 based) of cellStylesXfs item to be used in this style.

      @@ -545,9 +537,8 @@ index (0 based) of cellStylesXfs item to be used in this style. -

      -Creates a new Xf object. -

      +
      +

      Creates a new Xf object.

      @@ -569,9 +560,8 @@ Creates a new Xf object. -

      -Serializes the xf elemen. -

      +
      +

      Serializes the xf elemen.

      @@ -592,9 +582,8 @@ Serializes the xf elemen.

      -

      -Creates a new Xf object -

      + +

      Creates a new Xf object

      @@ -605,68 +594,18 @@ Creates a new Xf object
    • - [Integer] - - - (Hash) - - - - — -

      -a customizable set of options -

      -
      - -
    • - -
    • - - [Boolean] + options (Hash) - - — -

      -a customizable set of options -

      -
      - -
    • - -
    • - - [CellAlignment] - - - (Hash) - - - - — -

      -a customizable set of options -

      -
      - -
    • - -
    • - - [CellProtection] - - - (Hash) - + (defaults to: {}) — -

      -a customizable set of options -

      +
      +

      a customizable set of options

    • @@ -676,6 +615,146 @@ a customizable set of options +

      Options Hash (options):

      +
        + +
      • + numFmtId + (Integer) + + + + +
      • + +
      • + fontId + (Integer) + + + + +
      • + +
      • + fillId + (Integer) + + + + +
      • + +
      • + borderId + (Integer) + + + + +
      • + +
      • + xfId + (Integer) + + + + +
      • + +
      • + quotePrefix + (Boolean) + + + + +
      • + +
      • + pivotButton + (Boolean) + + + + +
      • + +
      • + applyNumberFormat + (Boolean) + + + + +
      • + +
      • + applyFont + (Boolean) + + + + +
      • + +
      • + applyFill + (Boolean) + + + + +
      • + +
      • + applyBorder + (Boolean) + + + + +
      • + +
      • + applyAlignment + (Boolean) + + + + +
      • + +
      • + applyProtection + (Boolean) + + + + +
      • + +
      • + alignment + (CellAlignment) + + + + +
      • + +
      • + protection + (CellProtection) + + + + +
      • + +
      +
      @@ -684,21 +763,20 @@ a customizable set of options
       
       
      -84
       85
       86
       87
      -88
      +88 +89
      -
      # 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
      -
      +
      # File 'lib/axlsx/stylesheet/xf.rb', line 85
      +
      +def initialize(options={})
      +  options.each do |o|
      +    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      +  end
      +end
      @@ -721,9 +799,8 @@ a customizable set of options

      -

      -The cell alignment for this style -

      + +

      The cell alignment for this style

      @@ -757,17 +834,16 @@ The cell alignment for this style
       
       
      -9
       10
      -11
      +11 +12 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 9
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 10
       
      -def alignment
      -  @alignment
      -end
      -
      +def alignment + @alignment +end
      @@ -785,9 +861,8 @@ The cell alignment for this style

      -

      -Indicates if the alignment options should be applied -

      + +

      Indicates if the alignment options should be applied

      @@ -814,17 +889,16 @@ Indicates if the alignment options should be applied
       
       
      -62
       63
      -64
      +64 +65 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 62
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 63
       
      -def applyAlignment
      -  @applyAlignment
      -end
      -
      +def applyAlignment + @applyAlignment +end
      @@ -842,9 +916,8 @@ Indicates if the alignment options should be applied

      -

      -indicates if the borderId should be applied -

      + +

      indicates if the borderId should be applied

      @@ -871,17 +944,16 @@ indicates if the borderId should be applied
       
       
      -58
       59
      -60
      +60 +61 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 58
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 59
       
      -def applyBorder
      -  @applyBorder
      -end
      -
      +def applyBorder + @applyBorder +end
      @@ -899,9 +971,8 @@ indicates if the borderId should be applied

      -

      -indicates if the fillId should be applied -

      + +

      indicates if the fillId should be applied

      @@ -928,17 +999,16 @@ indicates if the fillId should be applied
       
       
      -54
       55
      -56
      +56 +57 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 54
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 55
       
      -def applyFill
      -  @applyFill
      -end
      -
      +def applyFill + @applyFill +end
      @@ -956,9 +1026,8 @@ indicates if the fillId should be applied

      -

      -indicates if the fontId should be applied -

      + +

      indicates if the fontId should be applied

      @@ -985,17 +1054,16 @@ indicates if the fontId should be applied
       
       
      -50
       51
      -52
      +52 +53 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 50
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 51
       
      -def applyFont
      -  @applyFont
      -end
      -
      +def applyFont + @applyFont +end
      @@ -1013,9 +1081,8 @@ indicates if the fontId should be applied

      -

      -indicates if the numFmtId should be applied -

      + +

      indicates if the numFmtId should be applied

      @@ -1042,17 +1109,16 @@ indicates if the numFmtId should be applied
       
       
      -46
       47
      -48
      +48 +49 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 46
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 47
       
      -def applyNumberFormat
      -  @applyNumberFormat
      -end
      -
      +def applyNumberFormat + @applyNumberFormat +end
      @@ -1070,9 +1136,8 @@ indicates if the numFmtId should be applied

      -

      -Indicates if the protection options should be applied -

      + +

      Indicates if the protection options should be applied

      @@ -1099,17 +1164,16 @@ Indicates if the protection options should be applied
       
       
      -66
       67
      -68
      +68 +69 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 66
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 67
       
      -def applyProtection
      -  @applyProtection
      -end
      -
      +def applyProtection + @applyProtection +end
      @@ -1127,9 +1191,8 @@ Indicates if the protection options should be applied

      -

      -index (0 based) of the border to be used in this style -

      + +

      index (0 based) of the border to be used in this style

      @@ -1156,17 +1219,16 @@ index (0 based) of the border to be used in this style
       
       
      -30
       31
      -32
      +32 +33 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 30
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 31
       
      -def borderId
      -  @borderId
      -end
      -
      +def borderId + @borderId +end
      @@ -1184,9 +1246,8 @@ index (0 based) of the border to be used in this style

      -

      -index (0 based) of the fill to be used in this style -

      + +

      index (0 based) of the fill to be used in this style

      @@ -1213,17 +1274,16 @@ index (0 based) of the fill to be used in this style
       
       
      -26
       27
      -28
      +28 +29 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 26
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 27
       
      -def fillId
      -  @fillId
      -end
      -
      +def fillId + @fillId +end
      @@ -1241,9 +1301,8 @@ index (0 based) of the fill to be used in this style

      -

      -index (0 based) of the font to be used in this style -

      + +

      index (0 based) of the font to be used in this style

      @@ -1270,17 +1329,16 @@ index (0 based) of the font to be used in this style
       
       
      -22
       23
      -24
      +24 +25 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 22
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 23
       
      -def fontId
      -  @fontId
      -end
      -
      +def fontId + @fontId +end
      @@ -1298,9 +1356,8 @@ index (0 based) of the font to be used in this style

      -

      -id of the numFmt to apply to this style -

      + +

      id of the numFmt to apply to this style

      @@ -1327,17 +1384,16 @@ id of the numFmt to apply to this style
       
       
      -18
       19
      -20
      +20 +21 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 18
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 19
       
      -def numFmtId
      -  @numFmtId
      -end
      -
      +def numFmtId + @numFmtId +end
      @@ -1355,9 +1411,8 @@ id of the numFmt to apply to this style

      -

      -indicates if the cell has a pivot table drop down button -

      + +

      indicates if the cell has a pivot table drop down button

      @@ -1384,17 +1439,16 @@ indicates if the cell has a pivot table drop down button
       
       
      -42
       43
      -44
      +44 +45 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 42
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 43
       
      -def pivotButton
      -  @pivotButton
      -end
      -
      +def pivotButton + @pivotButton +end
      @@ -1412,9 +1466,8 @@ indicates if the cell has a pivot table drop down button

      -

      -The cell protection for this style -

      + +

      The cell protection for this style

      @@ -1448,17 +1501,16 @@ The cell protection for this style
       
       
      -14
       15
      -16
      +16 +17 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 14
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 15
       
      -def protection
      -  @protection
      -end
      -
      +def protection + @protection +end
      @@ -1476,9 +1528,8 @@ The cell protection for this style

      -

      -indecates if text should be prefixed by a single quote in the cell -

      + +

      indecates if text should be prefixed by a single quote in the cell

      @@ -1505,17 +1556,16 @@ indecates if text should be prefixed by a single quote in the cell
       
       
      -38
       39
      -40
      +40 +41 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 38
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 39
       
      -def quotePrefix
      -  @quotePrefix
      -end
      -
      +def quotePrefix + @quotePrefix +end
      @@ -1533,10 +1583,9 @@ indecates if text should be prefixed by a single quote in the cell

      -

      -index (0 based) of cellStylesXfs item to be used in this style. Only -applies to cellXfs items -

      + +

      index (0 based) of cellStylesXfs item to be used in this style. Only +applies to cellXfs items

      @@ -1563,17 +1612,16 @@ applies to cellXfs items
       
       
      -34
       35
      -36
      +36 +37 -
      # File 'lib/axlsx/stylesheet/xf.rb', line 34
      +      
      # File 'lib/axlsx/stylesheet/xf.rb', line 35
       
      -def xfId
      -  @xfId
      -end
      -
      +def xfId + @xfId +end
      @@ -1595,9 +1643,8 @@ applies to cellXfs items

      -

      -Serializes the xf elemen -

      + +

      Serializes the xf elemen

      @@ -1616,9 +1663,8 @@ Serializes the xf elemen — -

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

      +
      +

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

      @@ -1645,23 +1691,22 @@ The document builder instance this objects xml will be added to.
       
       
      -110
      -111
      -112
      -113
      -114
      -115
      +131 +132 +133 +134 +135 +136 -
      # 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
      -
      +
      # File 'lib/axlsx/stylesheet/xf.rb', line 131
      +
      +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
      @@ -1672,9 +1717,9 @@ The document builder instance this objects xml will be added to.
      diff --git a/doc/_index.html b/doc/_index.html index 2ffb447b..06787029 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -4,7 +4,7 @@ - Documentation by YARD 0.7.3 + AXLSX @@ -52,7 +52,7 @@ -

      Documentation by YARD 0.7.3

      +

      AXLSX

      Alphabetic Index

      @@ -63,6 +63,9 @@
    • README
    • +
    • LICENSE
    • + +
    @@ -492,13 +495,6 @@
  • -
  • - SimpleTypedList - - (Axlsx) - -
  • -
  • Styles @@ -630,9 +626,9 @@
  • diff --git a/doc/class_list.html b/doc/class_list.html index 060e3f46..2d555b04 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -39,7 +39,7 @@
    diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html new file mode 100644 index 00000000..239b148f --- /dev/null +++ b/doc/file.LICENSE.html @@ -0,0 +1,86 @@ + + + + + + File: LICENSE + + — AXLSX + + + + + + + + + + + + + + + + + + + + + + +
    +

    Copyright © 2011 Randy Morgan

    + +

    Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the “Software”), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions:

    + +

    The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software.

    + +

    THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE.

    +
    + + + + + \ No newline at end of file diff --git a/doc/file.README.html b/doc/file.README.html index 18af1cab..f76e610f 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -2,11 +2,11 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + File: README - — Documentation by YARD 0.7.3 + — AXLSX @@ -61,14 +61,18 @@ Author: Randy Morgan
    Copyright: 2011
    License: MIT License
    -Latest Version: 1.0.8
    -Ruby Version: 1.8.7
    -Release Date: November 23nd 2011

    +Latest Version: 1.0.9
    +Ruby Version: 1.8.7 - 1.9.3
    +Release Date: November 26th 2011

    Synopsis

    Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language. -It enables the you to generate 100% valid xlsx files that include customised styling, images, 3D pie, bar and line charts and auto-width columns. Below is a summary of salient features.

    +With Axlsx you can create worksheets with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine.

    + +

    Help Wanted

    + +

    I'd really like to get rid of the depenency on RMagick in this gem. RMagic is being used to calculate the column widths in a worksheet based on the content the user specified. If there happens to be anyone out there with the background and c skills to write an extenstion that can determine the width of a single character rendered with a specific font at a specific font size please give me a shout.

    Feature List

    @@ -90,130 +94,141 @@ It enables the you to generate 100% valid xlsx files that include customised sty

    To install Axlsx, use the following command:

    -
    $ gem install axlsx
    +
    $ gem install axlsx
     

    Usage

    Examples

    -
     require 'rubygems'
    - require 'axlsx'
    +
     require 'rubygems'
    + require 'axlsx'
     

    A Simple Workbook

    -
      p = Axlsx::Package.new
    -  p.workbook.add_worksheet do |sheet|
    -    sheet.add_row ["First", "Second", "Third"]
    -    sheet.add_row [1, 2, 3]
    -  end
    -  p.serialize("example1.xlsx")
    +
      p = Axlsx::Package.new
    +  p.workbook.add_worksheet do |sheet|
    +    sheet.add_row ["First", "Second", "Third"]
    +    sheet.add_row [1, 2, 3]
    +  end
    +  p.serialize("example1.xlsx")
     

    Generating A Bar Chart

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", "Second", "Third"]
    -   sheet.add_row [1, 2, 3]
    -   sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart|
    -     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    -   end
    - end  
    - p.serialize("example2.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", "Second", "Third"]
    +   sheet.add_row [1, 2, 3]
    +   sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart|
    +     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    +   end
    + end  
    + p.serialize("example2.xlsx")
     

    Generating A Pie Chart

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", "Second", "Third"]
    -   sheet.add_row [1, 2, 3]
    -   sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart|
    -     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    -   end
    - end  
    - p.serialize("example3.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", "Second", "Third"]
    +   sheet.add_row [1, 2, 3]
    +   sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart|
    +     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    +   end
    + end  
    + p.serialize("example3.xlsx")
     

    Using Custom Styles

    -
     p = Axlsx::Package.new
    - wb = p.workbook
    - black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    - blue_cell = wb.styles.add_style  :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    - wb.add_worksheet do |sheet|
    -   sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
    -   sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
    - end
    - p.serialize("example4.xlsx")
    +
     p = Axlsx::Package.new
    + wb = p.workbook
    + black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    + blue_cell = wb.styles.add_style  :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    + wb.add_worksheet do |sheet|
    +   sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
    +   sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
    + end
    + p.serialize("example4.xlsx")
     

    Using Custom Formatting and date1904

    -
     p = Axlsx::Package.new
    - wb = p.workbook
    - date = wb.styles.add_style :format_code=>"yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER
    - padded = wb.styles.add_style :format_code=>"00#", :border => Axlsx::STYLE_THIN_BORDER
    - percent = wb.styles.add_style :format_code=>"0%", :border => Axlsx::STYLE_THIN_BORDER
    - wb.date1904 = true # required for generation on mac
    - wb.add_worksheet do |sheet|
    -   sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER
    -   sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded]
    - end
    - p.serialize("example5.xlsx")
    +
     p = Axlsx::Package.new
    + wb = p.workbook
    + date = wb.styles.add_style :format_code=>"yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER
    + padded = wb.styles.add_style :format_code=>"00#", :border => Axlsx::STYLE_THIN_BORDER
    + percent = wb.styles.add_style :format_code=>"0%", :border => Axlsx::STYLE_THIN_BORDER
    + wb.date1904 = true # required for generation on mac
    + wb.add_worksheet do |sheet|
    +   sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER
    +   sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded]
    + end
    + p.serialize("example5.xlsx")
     

    Validation

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", "Second", "Third"]
    -   sheet.add_row [1, 2, 3]
    - end
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", "Second", "Third"]
    +   sheet.add_row [1, 2, 3]
    + end
     
    - p.validate.each do |error|
    -   puts error.inspect
    - end
    + p.validate.each do |error|
    +   puts error.inspect
    + end
     

    Generating A Line Chart

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", 1, 5, 7, 9]
    -   sheet.add_row ["Second", 5, 2, 14, 9]
    -   sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart|
    -     chart.start_at 0, 2
    -     chart.end_at 10, 15
    -     chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first
    -     chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first
    -   end
    -
    - end  
    - p.serialize("example6.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", 1, 5, 7, 9]
    +   sheet.add_row ["Second", 5, 2, 14, 9]
    +   sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart|
    +     chart.start_at 0, 2
    +     chart.end_at 10, 15
    +     chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first
    +     chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first
    +   end
    +
    + end  
    + p.serialize("example6.xlsx")
     

    Adding an Image

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_image(:image_src => (File.dirname(__FILE__) + "/image1.png")) do |image|
    -     image.width=720
    -     image.height=666
    -     image.start_at 2, 2
    -   end
    - end  
    - p.serialize("example7.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_image(:image_src => (File.dirname(__FILE__) + "/image1.png")) do |image|
    +     image.width=720
    +     image.height=666
    +     image.start_at 2, 2
    +   end
    + end  
    + p.serialize("example7.xlsx")
    +
    + +

    Asian Language Support

    + +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["日本語"]
    +   sheet.add_row ["华语/華語"]
    +   sheet.add_row ["한국어/조선말"]
    + end  
    + p.serialize("example8.xlsx")
     

    Documentation

    This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:

    -
      gem install yard
    -  yard server -g
    +
      gem install yard
    +  yard server -g
     

    Specs

    @@ -223,24 +238,11 @@ It enables the you to generate 100% valid xlsx files that include customised sty

    Changelog

      -
    • October.23.11: 1.0.8 release

      +
    • October.26.11: 1.0.9 release
        -
      • Added support for images (jpg, gif, png) in worksheets.
      • -
      -
    • -
    • October.23.11: 1.0.7 released

      - -
        -
      • Added support for 3D options when creating a new chart. This lets you set the persective, rotation and other 3D attributes when using worksheet.add_chart
      • -
      • Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions.
      • -
      • updated rake to include build, genoc and deploy tasks.
      • -
      • rebuilt documentation.
      • -
      • moved version constant to its own file
      • -
      • fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int.
      • -
      • Review and improve docs
      • -
      • rebuild of anchor positioning to remove some spagetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart.
      • -
      • Refactored cat and val axis data to keep series serialization a bit more DRY
      • +
      • Updated to support ruby 1.9.3
      • +
      • Updated to eliminate all warnings originating in this gem
    @@ -248,10 +250,6 @@ It enables the you to generate 100% valid xlsx files that include customised sty

    Please see the CHANGELOG document for past release information.

    -

    Help Wanted

    - -

    I'd really like to get rid of the depenency on RMagick in this gem. RMagic is being used to calculate the column widths in a worksheet based on the content the user specified. If there happens to be anyone out there with the background and skill set to write an extenstion that can determine the width of a single character rendered with a specific font at a specific size please give me a shout.

    -

    Copyright

    Axlsx © 2011 by Randy Morgan. Axlsx is @@ -259,9 +257,9 @@ licensed under the MIT license. Please see the

    diff --git a/doc/file_list.html b/doc/file_list.html index 2ea5474e..b552e568 100644 --- a/doc/file_list.html +++ b/doc/file_list.html @@ -43,6 +43,9 @@
  • README
  • +
  • LICENSE
  • + +
    diff --git a/doc/frames.html b/doc/frames.html index 4cc52cb7..ac451281 100644 --- a/doc/frames.html +++ b/doc/frames.html @@ -4,7 +4,7 @@ - Documentation by YARD 0.7.3 + AXLSX diff --git a/doc/index.html b/doc/index.html index 18af1cab..f76e610f 100644 --- a/doc/index.html +++ b/doc/index.html @@ -2,11 +2,11 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + File: README - — Documentation by YARD 0.7.3 + — AXLSX @@ -61,14 +61,18 @@ Author: Randy Morgan
    Copyright: 2011
    License: MIT License
    -Latest Version: 1.0.8
    -Ruby Version: 1.8.7
    -Release Date: November 23nd 2011

    +Latest Version: 1.0.9
    +Ruby Version: 1.8.7 - 1.9.3
    +Release Date: November 26th 2011

    Synopsis

    Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language. -It enables the you to generate 100% valid xlsx files that include customised styling, images, 3D pie, bar and line charts and auto-width columns. Below is a summary of salient features.

    +With Axlsx you can create worksheets with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine.

    + +

    Help Wanted

    + +

    I'd really like to get rid of the depenency on RMagick in this gem. RMagic is being used to calculate the column widths in a worksheet based on the content the user specified. If there happens to be anyone out there with the background and c skills to write an extenstion that can determine the width of a single character rendered with a specific font at a specific font size please give me a shout.

    Feature List

    @@ -90,130 +94,141 @@ It enables the you to generate 100% valid xlsx files that include customised sty

    To install Axlsx, use the following command:

    -
    $ gem install axlsx
    +
    $ gem install axlsx
     

    Usage

    Examples

    -
     require 'rubygems'
    - require 'axlsx'
    +
     require 'rubygems'
    + require 'axlsx'
     

    A Simple Workbook

    -
      p = Axlsx::Package.new
    -  p.workbook.add_worksheet do |sheet|
    -    sheet.add_row ["First", "Second", "Third"]
    -    sheet.add_row [1, 2, 3]
    -  end
    -  p.serialize("example1.xlsx")
    +
      p = Axlsx::Package.new
    +  p.workbook.add_worksheet do |sheet|
    +    sheet.add_row ["First", "Second", "Third"]
    +    sheet.add_row [1, 2, 3]
    +  end
    +  p.serialize("example1.xlsx")
     

    Generating A Bar Chart

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", "Second", "Third"]
    -   sheet.add_row [1, 2, 3]
    -   sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart|
    -     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    -   end
    - end  
    - p.serialize("example2.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", "Second", "Third"]
    +   sheet.add_row [1, 2, 3]
    +   sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart|
    +     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    +   end
    + end  
    + p.serialize("example2.xlsx")
     

    Generating A Pie Chart

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", "Second", "Third"]
    -   sheet.add_row [1, 2, 3]
    -   sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart|
    -     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    -   end
    - end  
    - p.serialize("example3.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", "Second", "Third"]
    +   sheet.add_row [1, 2, 3]
    +   sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart|
    +     chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
    +   end
    + end  
    + p.serialize("example3.xlsx")
     

    Using Custom Styles

    -
     p = Axlsx::Package.new
    - wb = p.workbook
    - black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    - blue_cell = wb.styles.add_style  :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    - wb.add_worksheet do |sheet|
    -   sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
    -   sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
    - end
    - p.serialize("example4.xlsx")
    +
     p = Axlsx::Package.new
    + wb = p.workbook
    + black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    + blue_cell = wb.styles.add_style  :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
    + wb.add_worksheet do |sheet|
    +   sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
    +   sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
    + end
    + p.serialize("example4.xlsx")
     

    Using Custom Formatting and date1904

    -
     p = Axlsx::Package.new
    - wb = p.workbook
    - date = wb.styles.add_style :format_code=>"yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER
    - padded = wb.styles.add_style :format_code=>"00#", :border => Axlsx::STYLE_THIN_BORDER
    - percent = wb.styles.add_style :format_code=>"0%", :border => Axlsx::STYLE_THIN_BORDER
    - wb.date1904 = true # required for generation on mac
    - wb.add_worksheet do |sheet|
    -   sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER
    -   sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded]
    - end
    - p.serialize("example5.xlsx")
    +
     p = Axlsx::Package.new
    + wb = p.workbook
    + date = wb.styles.add_style :format_code=>"yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER
    + padded = wb.styles.add_style :format_code=>"00#", :border => Axlsx::STYLE_THIN_BORDER
    + percent = wb.styles.add_style :format_code=>"0%", :border => Axlsx::STYLE_THIN_BORDER
    + wb.date1904 = true # required for generation on mac
    + wb.add_worksheet do |sheet|
    +   sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER
    +   sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded]
    + end
    + p.serialize("example5.xlsx")
     

    Validation

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", "Second", "Third"]
    -   sheet.add_row [1, 2, 3]
    - end
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", "Second", "Third"]
    +   sheet.add_row [1, 2, 3]
    + end
     
    - p.validate.each do |error|
    -   puts error.inspect
    - end
    + p.validate.each do |error|
    +   puts error.inspect
    + end
     

    Generating A Line Chart

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_row ["First", 1, 5, 7, 9]
    -   sheet.add_row ["Second", 5, 2, 14, 9]
    -   sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart|
    -     chart.start_at 0, 2
    -     chart.end_at 10, 15
    -     chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first
    -     chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first
    -   end
    -
    - end  
    - p.serialize("example6.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["First", 1, 5, 7, 9]
    +   sheet.add_row ["Second", 5, 2, 14, 9]
    +   sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart|
    +     chart.start_at 0, 2
    +     chart.end_at 10, 15
    +     chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first
    +     chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first
    +   end
    +
    + end  
    + p.serialize("example6.xlsx")
     

    Adding an Image

    -
     p = Axlsx::Package.new
    - p.workbook.add_worksheet do |sheet|
    -   sheet.add_image(:image_src => (File.dirname(__FILE__) + "/image1.png")) do |image|
    -     image.width=720
    -     image.height=666
    -     image.start_at 2, 2
    -   end
    - end  
    - p.serialize("example7.xlsx")
    +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_image(:image_src => (File.dirname(__FILE__) + "/image1.png")) do |image|
    +     image.width=720
    +     image.height=666
    +     image.start_at 2, 2
    +   end
    + end  
    + p.serialize("example7.xlsx")
    +
    + +

    Asian Language Support

    + +
     p = Axlsx::Package.new
    + p.workbook.add_worksheet do |sheet|
    +   sheet.add_row ["日本語"]
    +   sheet.add_row ["华语/華語"]
    +   sheet.add_row ["한국어/조선말"]
    + end  
    + p.serialize("example8.xlsx")
     

    Documentation

    This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:

    -
      gem install yard
    -  yard server -g
    +
      gem install yard
    +  yard server -g
     

    Specs

    @@ -223,24 +238,11 @@ It enables the you to generate 100% valid xlsx files that include customised sty

    Changelog

      -
    • October.23.11: 1.0.8 release

      +
    • October.26.11: 1.0.9 release
        -
      • Added support for images (jpg, gif, png) in worksheets.
      • -
      -
    • -
    • October.23.11: 1.0.7 released

      - -
        -
      • Added support for 3D options when creating a new chart. This lets you set the persective, rotation and other 3D attributes when using worksheet.add_chart
      • -
      • Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions.
      • -
      • updated rake to include build, genoc and deploy tasks.
      • -
      • rebuilt documentation.
      • -
      • moved version constant to its own file
      • -
      • fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int.
      • -
      • Review and improve docs
      • -
      • rebuild of anchor positioning to remove some spagetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart.
      • -
      • Refactored cat and val axis data to keep series serialization a bit more DRY
      • +
      • Updated to support ruby 1.9.3
      • +
      • Updated to eliminate all warnings originating in this gem
    @@ -248,10 +250,6 @@ It enables the you to generate 100% valid xlsx files that include customised sty

    Please see the CHANGELOG document for past release information.

    -

    Help Wanted

    - -

    I'd really like to get rid of the depenency on RMagick in this gem. RMagic is being used to calculate the column widths in a worksheet based on the content the user specified. If there happens to be anyone out there with the background and skill set to write an extenstion that can determine the width of a single character rendered with a specific font at a specific size please give me a shout.

    -

    Copyright

    Axlsx © 2011 by Randy Morgan. Axlsx is @@ -259,9 +257,9 @@ licensed under the MIT license. Please see the

    diff --git a/doc/method_list.html b/doc/method_list.html index 704dd4d6..db85672c 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -40,22 +40,6 @@
    diff --git a/examples/example.rb b/examples/example.rb index 50a3edb4..e8869f75 100644 --- a/examples/example.rb +++ b/examples/example.rb @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- +# encoding: utf-8 require 'rubygems' require 'axlsx' + #A Simple Workbook + p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| sheet.add_row ["First", "Second", "Third"] @@ -11,6 +14,7 @@ p.serialize("example1.xlsx") #Generating A Bar Chart + p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| sheet.add_row ["First", "Second", "Third"] @@ -22,6 +26,7 @@ p.serialize("example2.xlsx") #Generating A Pie Chart + p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| sheet.add_row ["First", "Second", "Third"] @@ -91,7 +96,8 @@ p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| - sheet.add_image(:image_src => (File.dirname(__FILE__) + "/image1.png")) do |image| + img = File.expand_path('examples/image1.jpeg') + sheet.add_image(:image_src => img) do |image| image.width=720 image.height=666 image.start_at 2, 2 @@ -100,11 +106,13 @@ p.serialize("example7.xlsx") -#Japanese Support +#Asian Language Support p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| - sheet.add_row ["日本語の表意","ちゃんと出来るかな"] - sheet.add_row ["
    ","escaped?"] + sheet.add_row ["日本語"] + sheet.add_row ["华语/華語"] + sheet.add_row ["한국어/조선말"] end p.serialize("example8.xlsx") + diff --git a/lib/axlsx.rb b/lib/axlsx.rb index 3a665740..aee52b36 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -1,3 +1,7 @@ + +Encoding::default_internal = 'UTF-8' unless RUBY_VERSION < '1.9' +Encoding::default_external = 'UTF-8' unless RUBY_VERSION < '1.9' + require 'axlsx/util/simple_typed_list.rb' require 'axlsx/util/constants.rb' require 'axlsx/util/validators.rb' @@ -13,26 +17,27 @@ require 'axlsx/workbook/workbook.rb' require 'axlsx/package.rb' -module Axlsx - #required gems - require 'Nokogiri' - require 'active_support/core_ext/object/instance_variables' - require 'active_support/inflector' - require 'rmagick' - require 'zip/zip' +#required gems +require 'Nokogiri' +require 'active_support/core_ext/object/instance_variables' +require 'active_support/inflector' +require 'rmagick' +require 'zip/zip' - #core dependencies - require 'bigdecimal' - require 'time' - require 'CGI' +#core dependencies +require 'bigdecimal' +require 'time' +require 'CGI' +# xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine. +module Axlsx # determines the cell range for the items provided 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}" + ref = "#{items.first.row.worksheet.name}!" + + "#{items.first.r_abs}" + ref += ":#{items.last.r_abs}" if items.size > 1 + ref end - - end diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb index c82e5f7d..5c688568 100644 --- a/lib/axlsx/content_type/default.rb +++ b/lib/axlsx/content_type/default.rb @@ -4,10 +4,11 @@ module Axlsx # The extension of the content type. # @return [String] - attr_accessor :Extension + attr_reader :Extension - # @return [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 - attr_accessor :ContentType + # The type of content. + # @return [String] + attr_reader :ContentType #Creates a new Default object # @option options [String] Extension @@ -19,7 +20,11 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end + # Sets the file extension for this content type. def Extension=(v) Axlsx::validate_string v; @Extension = v end + + # Sets the content type + # @see Axlsx#validate_content_type def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end # Serializes the object to xml diff --git a/lib/axlsx/content_type/override.rb b/lib/axlsx/content_type/override.rb index 4d1b008f..362e834b 100644 --- a/lib/axlsx/content_type/override.rb +++ b/lib/axlsx/content_type/override.rb @@ -2,11 +2,13 @@ module Axlsx # An override content part. These parts are automatically created by for you based on the content of your package. class Override - # @return [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 - attr_accessor :ContentType + # The type of content. + # @return [String] + attr_reader :ContentType - # @return [String] PartName The name and location of the part. - attr_accessor :PartName + # The name and location of the part. + # @return [String] + attr_reader :PartName #Creates a new Override object # @option options [String] PartName @@ -18,7 +20,12 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end + + # The name and location of the part. def PartName=(v) Axlsx::validate_string v; @PartName = v end + + # The content type. + # @see Axlsx#validate_content_type def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end # Serializes the Override object to xml diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index 77e7ea42..8e6bea27 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -11,73 +11,73 @@ module Axlsx class App # @return [String] The name of the document template. - attr_accessor :Template + attr_reader :Template # @return [String] The name of the manager for the document. - attr_accessor :Manager + attr_reader :Manager # @return [String] The name of the company generating the document. - attr_accessor :Company + attr_reader :Company # @return [Integer] The number of pages in the document. - attr_accessor :Pages + attr_reader :Pages # @return [Integer] The number of words in the document. - attr_accessor :Words + attr_reader :Words # @return [Integer] The number of characters in the document. - attr_accessor :Characters + attr_reader :Characters # @return [String] The intended format of the presentation. - attr_accessor :PresentationFormat + attr_reader :PresentationFormat # @return [Integer] The number of lines in the document. - attr_accessor :Lines + attr_reader :Lines # @return [Integer] The number of paragraphs in the document - attr_accessor :Paragraphs + attr_reader :Paragraphs # @return [Intger] The number of slides in the document. - attr_accessor :Slides + attr_reader :Slides # @return [Integer] The number of slides that have notes. - attr_accessor :Notes + attr_reader :Notes # @return [Integer] The total amount of time spent editing. - attr_accessor :TotalTime + attr_reader :TotalTime # @return [Integer] The number of hidden slides. - attr_accessor :HiddenSlides + attr_reader :HiddenSlides # @return [Integer] The total number multimedia clips - attr_accessor :MMClips + attr_reader :MMClips # @return [Boolean] The display mode for the document thumbnail. - attr_accessor :ScaleCrop + attr_reader :ScaleCrop # @return [Boolean] The links in the document are up to date. - attr_accessor :LinksUpToDate + attr_reader :LinksUpToDate # @return [Integer] The number of characters in the document including spaces. - attr_accessor :CharactersWithSpaces + attr_reader :CharactersWithSpaces # @return [Boolean] Indicates if the document is shared. - attr_accessor :ShareDoc + attr_reader :ShareDoc # @return [String] The base for hyper links in the document. - attr_accessor :HyperLinkBase + attr_reader :HyperLinkBase # @return [Boolean] Indicates that the hyper links in the document have been changed. - attr_accessor :HyperlinksChanged + attr_reader :HyperlinksChanged # @return [String] The name of the application - attr_accessor :Application + attr_reader :Application # @return [String] The version of the application. - attr_accessor :AppVersion + attr_reader :AppVersion # @return [Integer] Document security - attr_accessor :DocSecurity + attr_reader :DocSecurity # Creates an App object # @option options [String] Template @@ -108,28 +108,58 @@ module Axlsx end end + # Sets the Template property of your app.xml file def Template=(v) Axlsx::validate_string v; @Template = v; end + + # Sets the Manager property of your app.xml file def Manager=(v) Axlsx::validate_string v; @Manager = v; end + + # Sets the Company property of your app.xml file def Company=(v) Axlsx::validate_string v; @Company = v; end + + # Sets the Pages property of your app.xml file def Pages=(v) Axlsx::validate_int v; @Pages = v; end + + # Sets the Words property of your app.xml file def Words=(v) Axlsx::validate_int v; @Words = v; end + + # Sets the Characters property of your app.xml file def Characters=(v) Axlsx::validate_int v; @Characters = v; end + + + # Sets the PresentationFormat property of your app.xml file def PresentationFormat=(v) Axlsx::validate_string v; @PresentationFormat = v; end + # Sets the Lines property of your app.xml file def Lines=(v) Axlsx::validate_int v; @Lines = v; end + # Sets the Paragraphs property of your app.xml file def Paragraphs=(v) Axlsx::validate_int v; @Paragraphs = v; end + # Sets the Slides property of your app.xml file def Slides=(v) Axlsx::validate_int v; @Slides = v; end + # Sets the Notes property of your app.xml file def Notes=(v) Axlsx::validate_int v; @Notes = v; end + # Sets the TotalTime property of your app.xml file def TotalTime=(v) Axlsx::validate_int v; @TotalTime = v; end + # Sets the HiddenSlides property of your app.xml file def HiddenSlides=(v) Axlsx::validate_int v; @HiddenSlides = v; end + # Sets the MMClips property of your app.xml file def MMClips=(v) Axlsx::validate_int v; @MMClips = v; end + # Sets the ScaleCrop property of your app.xml file def ScaleCrop=(v) Axlsx::validate_boolean v; @ScaleCrop = v; end + # Sets the LinksUpToDate property of your app.xml file def LinksUpToDate=(v) Axlsx::validate_boolean v; @LinksUpToDate = v; end + # Sets the CharactersWithSpaces property of your app.xml file def CharactersWithSpaces=(v) Axlsx::validate_int v; @CharactersWithSpaces = v; end + # Sets the ShareDoc property of your app.xml file def ShareDoc=(v) Axlsx::validate_boolean v; @ShareDoc = v; end + # Sets the HyperLinkBase property of your app.xml file def HyperLinkBase=(v) Axlsx::validate_string v; @HyperLinkBase = v; end + # Sets the HyperLinksChanged property of your app.xml file def HyperlinksChanged=(v) Axlsx::validate_boolean v; @HyperlinksChanged = v; end + # Sets the Application property of your app.xml file def Application=(v) Axlsx::validate_string v; @Application = v; end + # Sets the AppVersion property of your app.xml file def AppVersion=(v) Axlsx::validate_string v; @AppVersion = v; end + # Sets the DocSecurity property of your app.xml file def DocSecurity=(v) Axlsx::validate_int v; @DocSecurity = v; end # Generate an app.xml document diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index 7e48801a..b89ef70c 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -18,22 +18,22 @@ module Axlsx # The position of the axis # must be one of [:l, :r, :t, :b] # @return [Symbol] - attr_accessor :axPos + attr_reader :axPos # the position of the tick labels # must be one of [:nextTo, :high, :low] # @return [Symbol] - attr_accessor :tickLblPos + attr_reader :tickLblPos # The number format format code for this axis # default :General # @return [String] - attr_accessor :format_code + attr_reader :format_code # specifies how the perpendicular axis is crossed # must be one of [:autoZero, :min, :max] # @return [Symbol] - attr_accessor :crosses + attr_reader :crosses # Creates an Axis object # @param [Integer] axId the id of this axis @@ -47,6 +47,7 @@ module Axlsx Axlsx::validate_unsigned_int(crossAx) @axId = axId @crossAx = crossAx + @format_code = "General" @scaling = Scaling.new(:orientation=>:minMax) self.axPos = :l self.tickLblPos = :nextTo @@ -56,10 +57,20 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end - + # The position of the axis + # must be one of [:l, :r, :t, :b] def axPos=(v) RestrictionValidator.validate "#{self.class}.axPos", [:l, :r, :b, :t], v; @axPos = v; end + + # the position of the tick labels + # must be one of [:nextTo, :high, :low1] def tickLblPos=(v) RestrictionValidator.validate "#{self.class}.tickLblPos", [:nextTo, :high, :low], v; @tickLblPos = v; end + + # The number format format code for this axis + # default :General def format_code=(v) Axlsx::validate_string(v); @formatCode = v; end + + # specifies how the perpendicular axis is crossed + # must be one of [:autoZero, :min, :max] def crosses=(v) RestrictionValidator.validate "#{self.class}.crosses", [:autoZero, :min, :max], v; @crosses = v; end # Serializes the common axis diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 3d7f6296..6d74022f 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -18,25 +18,25 @@ module Axlsx # The direction of the bars in the chart # must be one of [:bar, :col] # @return [Symbol] - attr_accessor :barDir + attr_reader :barDir # space between bar or column clusters, as a percentage of the bar or column width. # @return [String] - attr_accessor :gapDepth + attr_reader :gapDepth # space between bar or column clusters, as a percentage of the bar or column width. # @return [String] - attr_accessor :gapWidth + attr_reader :gapWidth #grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] - attr_accessor :grouping + attr_reader :grouping # The shabe of the bars or columns # must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax] # @return [Symbol] - attr_accessor :shape + attr_reader :shape # validation regex for gap amount percent GAP_AMOUNT_PERCENT = /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/ @@ -61,6 +61,7 @@ module Axlsx def initialize(frame, options={}) @barDir = :bar @grouping = :clustered + @gapWidth, @gapDepth, @shape = nil, nil, nil @catAxId = rand(8 ** 8) @valAxId = rand(8 ** 8) @catAxis = CatAxis.new(@catAxId, @valAxId) @@ -69,28 +70,35 @@ module Axlsx @series_type = BarSeries @view3D = View3D.new({:rAngAx=>1}.merge(options)) end - + + # The direction of the bars in the chart + # must be one of [:bar, :col] def barDir=(v) RestrictionValidator.validate "Bar3DChart.barDir", [:bar, :col], v @barDir = v end - + #grouping for a column, line, or area chart. + # must be one of [:percentStacked, :clustered, :standard, :stacked] def grouping=(v) RestrictionValidator.validate "Bar3DChart.grouping", [:percentStacked, :clustered, :standard, :stacked], v @grouping = v end + # space between bar or column clusters, as a percentage of the bar or column width. def gapWidth=(v) RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v @gapWidth=(v) end + # space between bar or column clusters, as a percentage of the bar or column width. def gapDepth=(v) RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v @gapDepth=(v) end + # The shabe of the bars or columns + # must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax] def shape=(v) RestrictionValidator.validate "Bar3DChart.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v @shape = v diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb index c4bffa8c..129a13e8 100644 --- a/lib/axlsx/drawing/bar_series.rb +++ b/lib/axlsx/drawing/bar_series.rb @@ -17,7 +17,7 @@ module Axlsx # The shabe of the bars or columns # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] - attr_accessor :shape + attr_reader :shape # Creates a new series # @option options [Array, SimpleTypedList] data @@ -32,6 +32,8 @@ module Axlsx self.data = ValAxisData.new(options[:data]) unless options[:data].nil? end + # The shabe of the bars or columns + # must be one of [:percentStacked, :clustered, :standard, :stacked] def shape=(v) RestrictionValidator.validate "BarSeries.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v @shape = v @@ -41,10 +43,10 @@ module Axlsx # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. # @return [String] def to_xml(xml) - super(xml) do |xml| - @labels.to_xml(xml) unless @labels.nil? - @data.to_xml(xml) unless @data.nil? - xml.send('c:shape', :val=>@shape) + super(xml) do |xml_inner| + @labels.to_xml(xml_inner) unless @labels.nil? + @data.to_xml(xml_inner) unless @data.nil? + xml_inner.send('c:shape', :val=>@shape) end end diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index 083eac68..54066aa0 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -4,17 +4,17 @@ module Axlsx # 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. # @return [Boolean] - attr_accessor :auto + attr_reader :auto # specifies how the perpendicular axis is crossed # must be one of [:ctr, :l, :r] # @return [Symbol] - attr_accessor :lblAlgn + attr_reader :lblAlgn # The offset of the labels # must be between a string between 0 and 1000 # @return [Integer] - attr_accessor :lblOffset + attr_reader :lblOffset # regex for validating label offset LBL_OFFSET_REGEX = /0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)%/ @@ -35,8 +35,15 @@ module Axlsx super(axId, crossAx, options) end + # 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. def auto=(v) Axlsx::validate_boolean(v); @auto = v; end + + # specifies how the perpendicular axis is crossed + # must be one of [:ctr, :l, :r] def lblAlgn=(v) RestrictionValidator.validate "#{self.class}.lblAlgn", [:ctr, :l, :r], v; @lblAlgn = v; end + + # The offset of the labels + # must be between a string between 0 and 1000 def lblOffset=(v) RegexValidator.validate "#{self.class}.lblOffset", LBL_OFFSET_REGEX, v; @lblOffset = v; end # Serializes the category axis diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 6be9cbfe..45c75bda 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -21,29 +21,21 @@ module Axlsx # @return [Series] attr_reader :series_type - # The index of this chart in the workbooks charts collection - # @return [Integer] - attr_reader :index - - # The part name for this chart - # @return [String] - attr_reader :pn - #TODO data labels! - #attr_accessor :dLabls + #attr_reader :dLabls # The title object for the chart. # @return [Title] - attr_accessor :title + attr_reader :title # The style for the chart. # see ECMA Part 1 §21.2.2.196 # @return [Integer] - attr_accessor :style + attr_reader :style # Show the legend in the chart # @return [Boolean] - attr_accessor :show_legend + attr_reader :show_legend # Creates a new chart object # @param [GraphicalFrame] frame The frame that holds this chart. @@ -59,28 +51,42 @@ module Axlsx options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end - start_at *options[:start_at] if options[:start_at] - end_at *options[:end_at] if options[:start_at] + start_at(*options[:start_at]) if options[:start_at] + end_at(*options[:end_at]) if options[:start_at] yield self if block_given? end + # The index of this chart in the workbooks charts collection + # @return [Integer] def index @graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self) end + # The part name for this chart + # @return [String] def pn "#{CHART_PN % (index+1)}" end + # The title object for the chart. + # @param [String, Cell] v + # @return [Title] def title=(v) v = Title.new(v) if v.is_a?(String) || v.is_a?(Cell) DataTypeValidator.validate "#{self.class}.title", Title, v @title = v end + # Show the legend in the chart + # @param [Boolean] v + # @return [Boolean] def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end - def style=(v) DataTypeValidator.validate "Chart.style", Integer, v, lambda { |v| v >= 1 && v <= 48 }; @style = v; end + + # The style for the chart. + # see ECMA Part 1 §21.2.2.196 + # @param [Integer] v must be between 1 and 48 + def style=(v) DataTypeValidator.validate "Chart.style", Integer, v, lambda { |arg| arg >= 1 && arg <= 48 }; @style = v; end # backwards compatibility to allow chart.to and chart.from access to anchor markers # @note This will be disconinued in version 2.0.0. Please use the end_at method diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 17347cd1..4fa7dc11 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -47,34 +47,6 @@ module Axlsx # @return [SimpleTypedList] attr_reader :anchors - # An array of charts that are associated with this drawing's anchors - # @return [Array] - attr_reader :charts - - # An array of image objects that are associated with this drawing's anchors - # @return [Array] - attr_reader :images - - # The index of this drawing in the owning workbooks's drawings collection. - # @return [Integer] - attr_reader :index - - # The relation reference id for this drawing - # @return [String] - attr_reader :rId - - # The part name for this drawing - # @return [String] - attr_reader :pn - - # The relational part name for this drawing - # @return [String] - attr_reader :rels_pn - - # The drawing's relationships. - # @return [Relationships] - attr_reader :relationships - # Creates a new Drawing object # @param [Worksheet] worksheet The worksheet that owns this drawing def initialize(worksheet) @@ -99,33 +71,47 @@ module Axlsx TwoCellAnchor.new(self, options) @anchors.last.add_chart(chart_type, options) end - + + # An array of charts that are associated with this drawing's anchors + # @return [Array] def charts charts = @anchors.select { |a| a.object.is_a?(GraphicFrame) } charts.map { |a| a.object.chart } end + # An array of image objects that are associated with this drawing's anchors + # @return [Array] def images images = @anchors.select { |a| a.object.is_a?(Pic) } images.map { |a| a.object } end + # The index of this drawing in the owning workbooks's drawings collection. + # @return [Integer] def index @worksheet.workbook.drawings.index(self) end + # The relation reference id for this drawing + # @return [String] def rId "rId#{index+1}" end + # The part name for this drawing + # @return [String] def pn "#{DRAWING_PN % (index+1)}" end - + + # The relational part name for this drawing + # @return [String] def rels_pn "#{DRAWING_RELS_PN % (index+1)}" end + # The drawing's relationships. + # @return [Relationships] def relationships r = Relationships.new charts.each do |chart| diff --git a/lib/axlsx/drawing/graphic_frame.rb b/lib/axlsx/drawing/graphic_frame.rb index e8e5ba21..0b1f6d14 100644 --- a/lib/axlsx/drawing/graphic_frame.rb +++ b/lib/axlsx/drawing/graphic_frame.rb @@ -12,10 +12,6 @@ module Axlsx # @return [TwoCellAnchor] attr_reader :anchor - # The relationship id for this graphic - # @return [String] - attr_reader :rId - # Creates a new GraphicFrame object # @param [TwoCellAnchor] anchor # @param [Class] chart_type @@ -25,6 +21,8 @@ module Axlsx @chart = chart_type.new(self, options) end + # The relationship id for this graphic + # @return [String] def rId "rId#{@anchor.index+1}" end diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index 6fb34afb..af0cac86 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -34,12 +34,12 @@ module Axlsx # space between bar or column clusters, as a percentage of the bar or column width. # @return [String] - attr_accessor :gapDepth + attr_reader :gapDepth #grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] - attr_accessor :grouping + attr_reader :grouping # validation regex for gap amount percent GAP_AMOUNT_PERCENT = /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/ @@ -59,6 +59,7 @@ module Axlsx # @see Chart # @see View3D def initialize(frame, options={}) + @gapDepth = nil @grouping = :standard @catAxId = rand(8 ** 8) @valAxId = rand(8 ** 8) @@ -71,11 +72,13 @@ module Axlsx @view3D = View3D.new({:perspective=>30}.merge(options)) end + # @see grouping def grouping=(v) RestrictionValidator.validate "Bar3DChart.grouping", [:percentStacked, :standard, :stacked], v @grouping = v end + # @see gapDepth def gapDepth=(v) RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v @gapDepth=(v) diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb index 40beeb84..c56980fc 100644 --- a/lib/axlsx/drawing/line_series.rb +++ b/lib/axlsx/drawing/line_series.rb @@ -18,18 +18,19 @@ module Axlsx # @option options [Array, SimpleTypedList] labels # @param [Chart] chart def initialize(chart, options={}) + @labels, @data = nil, nil super(chart, options) - self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? - self.data = ValAxisData.new(options[:data]) unless options[:data].nil? + @labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? + @data = ValAxisData.new(options[:data]) unless options[:data].nil? end # Serializes the series # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. # @return [String] def to_xml(xml) - super(xml) do |xml| - @labels.to_xml(xml) unless @labels.nil? - @data.to_xml(xml) unless @data.nil? + super(xml) do |xml_inner| + @labels.to_xml(xml_inner) unless @labels.nil? + @data.to_xml(xml_inner) unless @data.nil? end end diff --git a/lib/axlsx/drawing/marker.rb b/lib/axlsx/drawing/marker.rb index 019c14d9..6cd7acd6 100644 --- a/lib/axlsx/drawing/marker.rb +++ b/lib/axlsx/drawing/marker.rb @@ -6,19 +6,19 @@ module Axlsx # The column this marker anchors to # @return [Integer] - attr_accessor :col + attr_reader :col # The offset distance from this marker's column # @return [Integer] - attr_accessor :colOff + attr_reader :colOff # The row this marker anchors to # @return [Integer] - attr_accessor :row + attr_reader :row # The offset distance from this marker's row # @return [Integer] - attr_accessor :rowOff + attr_reader :rowOff # Creates a new Marker object # @option options [Integer] col @@ -32,11 +32,15 @@ module Axlsx end end + # @see col def col=(v) Axlsx::validate_unsigned_int v; @col = v end + # @see colOff def colOff=(v) Axlsx::validate_int v; @colOff = v end + # @see row def row=(v) Axlsx::validate_unsigned_int v; @row = v end + # @see rowOff def rowOff=(v) Axlsx::validate_int v; @rowOff = v end - + # shortcut to set the column, row position for this marker # @param col the column for the marker # @param row the row of the marker diff --git a/lib/axlsx/drawing/one_cell_anchor.rb b/lib/axlsx/drawing/one_cell_anchor.rb index caa0edae..0626502e 100644 --- a/lib/axlsx/drawing/one_cell_anchor.rb +++ b/lib/axlsx/drawing/one_cell_anchor.rb @@ -17,20 +17,15 @@ module Axlsx # @return [Drawing] attr_reader :drawing - # The index of this anchor in the drawing - # @return [Integer] - attr_reader :index - - # the width of the graphic object in pixels. # this is converted to EMU at a 92 ppi resolution # @return [Integer] - attr_accessor :width + attr_reader :width # the height of the graphic object in pixels # this is converted to EMU at a 92 ppi resolution # @return [Integer] - attr_accessor :height + attr_reader :height # Creates a new OneCellAnchor object and an Pic associated with it. @@ -53,9 +48,14 @@ module Axlsx @object = Pic.new(self, options) end + # @see height def height=(v) Axlsx::validate_unsigned_int(v); @height = v; end + + # @see width def width=(v) Axlsx::validate_unsigned_int(v); @width = v; end + # The index of this anchor in the drawing + # @return [Integer] def index @drawing.anchors.index(self) end diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 7043df35..84e750ce 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -10,50 +10,22 @@ module Axlsx # The name to use for this picture # @return [String] - attr_accessor :name + attr_reader :name - # providing access to the anchor's width attribute - # @param [Integer] v - # @see OneCellAnchor.width - attr_accessor :width - - # providing access to update the anchor's height attribute - # @param [Integer] v - # @see OneCellAnchor.width - attr_accessor :height # A description of the picture # @return [String] - attr_accessor :descr + attr_reader :descr # The path to the image you want to include # Only local images are supported at this time and only jpg support # @return [String] - attr_accessor :image_src + attr_reader :image_src # The anchor for this image # @return [OneCellAnchor] attr_reader :anchor - # returns the extension of image_src without the preceeding '.' - # @return [String] - attr_reader :extname - - # The file name of image_src without any path information - # @return [String] - attr_reader :file_name - - # The part name for this image used in serialization and relationship building - # @return [String] - attr_reader :pn - - # The index of this image in the workbooks images collections - # @return [Index] - attr_reader :index - - # The name of the image file, sans directory info - # @return [String] - attr_reader :file_name # Creates a new Pic(ture) object # @param [Anchor] anchor the anchor that holds this image @@ -69,7 +41,7 @@ module Axlsx options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end - start_at *options[:start_at] if options[:start_at] + start_at(*options[:start_at]) if options[:start_at] yield self if block_given? end @@ -80,41 +52,61 @@ module Axlsx @image_src = v end + # @see name def name=(v) Axlsx::validate_string(v); @name = v; end + + # @see descr def descr=(v) Axlsx::validate_string(v); @descr = v; end + + # The file name of image_src without any path information + # @return [String] def file_name File.basename(image_src) unless image_src.nil? end + # returns the extension of image_src without the preceeding '.' + # @return [String] def extname File.extname(image_src).delete('.') unless image_src.nil? end + # The index of this image in the workbooks images collections + # @return [Index] def index @anchor.drawing.worksheet.workbook.images.index(self) end - + + # The part name for this image used in serialization and relationship building + # @return [String] def pn "#{IMAGE_PN % [(index+1), extname]}" end + # providing access to the anchor's width attribute + # @param [Integer] v + # @see OneCellAnchor.width def width @anchor.width end + # @see width def width=(v) @anchor.width = v end - def height=(v) - @anchor.height = v - end - + # providing access to update the anchor's height attribute + # @param [Integer] v + # @see OneCellAnchor.width def height @anchor.height end + # @see height + def height=(v) + @anchor.height = v + end + # This is a short cut method to set the start anchor position # If you need finer granularity in positioning use # graphic_frame.anchor.from.colOff / rowOff diff --git a/lib/axlsx/drawing/pie_series.rb b/lib/axlsx/drawing/pie_series.rb index 1f20058d..f72802f6 100644 --- a/lib/axlsx/drawing/pie_series.rb +++ b/lib/axlsx/drawing/pie_series.rb @@ -15,7 +15,7 @@ module Axlsx # The explosion for this series # @return [Integert] - attr_accessor :explosion + attr_reader :explosion # Creates a new series # @option options [Array, SimpleTypedList] data @@ -24,21 +24,23 @@ module Axlsx # @option options [Integer] explosion # @param [Chart] chart def initialize(chart, options={}) + @explosion = nil super(chart, options) self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? self.data = ValAxisData.new(options[:data]) unless options[:data].nil? end + # @see explosion def explosion=(v) Axlsx::validate_unsigned_int(v); @explosion = v; end # Serializes the series # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. # @return [String] def to_xml(xml) - super(xml) do |xml| - xml.send('c:explosion', :val=>@explosion) unless @explosion.nil? - @labels.to_xml(xml) unless @labels.nil? - @data.to_xml(xml) unless @data.nil? + super(xml) do |xml_inner| + xml_inner.send('c:explosion', :val=>@explosion) unless @explosion.nil? + @labels.to_xml(xml_inner) unless @labels.nil? + @data.to_xml(xml_inner) unless @data.nil? end end private diff --git a/lib/axlsx/drawing/scaling.rb b/lib/axlsx/drawing/scaling.rb index c0665463..e89d00f1 100644 --- a/lib/axlsx/drawing/scaling.rb +++ b/lib/axlsx/drawing/scaling.rb @@ -5,20 +5,20 @@ module Axlsx # logarithmic base for a logarithmic axis. # must be between 2 and 1000 # @return [Integer] - attr_accessor :logBase + attr_reader :logBase # the orientation of the axis # must be one of [:minMax, :maxMin] # @return [Symbol] - attr_accessor :orientation + attr_reader :orientation # the maximum scaling # @return [Float] - attr_accessor :max + attr_reader :max # the minimu scaling # @return [Float] - attr_accessor :min + attr_reader :min # creates a new Scaling object # @option options [Integer, Fixnum] logBase @@ -27,14 +27,20 @@ module Axlsx # @option options [Float] min def initialize(options={}) @orientation = :minMax + @logBase, @min, @max = nil, nil, nil options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end - def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer, Fixnum], v, lambda { |v| v >= 2 && v <= 1000}; @logBase = v; end + # @see logBase + def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer, Fixnum], v, lambda { |arg| arg >= 2 && arg <= 1000}; @logBase = v; end + # @see orientation def orientation=(v) RestrictionValidator.validate "Scaling.orientation", [:minMax, :maxMin], v; @orientation = v; end + # @see max def max=(v) DataTypeValidator.validate "Scaling.max", Float, v; @max = v; end + + # @see min def min=(v) DataTypeValidator.validate "Scaling.min", Float, v; @min = v; end # Serializes the axId diff --git a/lib/axlsx/drawing/ser_axis.rb b/lib/axlsx/drawing/ser_axis.rb index a086b23c..077b92d7 100644 --- a/lib/axlsx/drawing/ser_axis.rb +++ b/lib/axlsx/drawing/ser_axis.rb @@ -4,11 +4,11 @@ module Axlsx # The number of tick lables to skip between labels # @return [Integer] - attr_accessor :tickLblSkip + attr_reader :tickLblSkip # The number of tickmarks to be skipped before the next one is rendered. # @return [Boolean] - attr_accessor :tickMarkSkip + attr_reader :tickMarkSkip # Creates a new SerAxis object # @param [Integer] axId the id of this axis. Inherited @@ -19,10 +19,14 @@ module Axlsx # @option options [Integer] tickLblSkip # @option options [Integer] tickMarkSkip def initialize(axId, crossAx, options={}) + @tickLblSkip, @tickMarkSkip = nil, nil super(axId, crossAx, options) end + # @see tickLblSkip def tickLblSkip=(v) Axlsx::validate_unsigned_int(v); @tickLblSkip = v; end + + # @see tickMarkSkip def tickMarkSkip=(v) Axlsx::validate_unsigned_int(v); @tickMarkSkip = v; end # Serializes the series axis diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index cb5d6a8d..3647f22e 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -9,40 +9,40 @@ module Axlsx # @return [Chart] attr_reader :chart - # The index of this series in the chart's series. - # @return [Integer] - attr_reader :index - - # The order of this series in the chart's series. By default the order is the index of the series. - # @return [Integer] - attr_accessor :order - # The title of the series # @return [SeriesTitle] - attr_accessor :title + attr_reader :title # Creates a new series # @param [Chart] chart # @option options [Integer] order # @option options [String] title def initialize(chart, options={}) + @order = nil self.chart = chart @chart.series << self options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end - + + # The index of this series in the chart's series. + # @return [Integer] def index @chart.series.index(self) end - def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end + # The order of this series in the chart's series. By default the order is the index of the series. + # @return [Integer] def order @order || index end + # @see order + def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end + + # @see title def title=(v) v = SeriesTitle.new(v) if v.is_a?(String) || v.is_a?(Cell) DataTypeValidator.validate "#{self.class}.title", SeriesTitle, v diff --git a/lib/axlsx/drawing/series_title.rb b/lib/axlsx/drawing/series_title.rb index bfb1b56f..de977633 100644 --- a/lib/axlsx/drawing/series_title.rb +++ b/lib/axlsx/drawing/series_title.rb @@ -8,7 +8,7 @@ module Axlsx def to_xml(xml) xml.send('c:tx') { xml.send('c:strRef') { - xml.send('c:f', range) + xml.send('c:f', Axlsx::cell_range([@cell])) xml.send('c:strCache') { xml.send('c:ptCount', :val=>1) xml.send('c:pt', :idx=>0) { diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index bdbf0e5c..f8c87921 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -4,11 +4,11 @@ module Axlsx # The text to be shown. Setting this property directly with a string will remove the cell reference. # @return [String] - attr_accessor :text + attr_reader :text # The cell that holds the text for the title. Setting this property will automatically update the text attribute. # @return [Cell] - attr_accessor :cell + attr_reader :cell # Creates a new Title object # @param [String, Cell] title The cell or string to be used for the chart's title @@ -17,6 +17,7 @@ module Axlsx self.text = title.to_s unless title.is_a?(Cell) end + # @see text def text=(v) DataTypeValidator.validate 'Title.text', String, v @text = v @@ -24,6 +25,7 @@ module Axlsx v end + # @see cell def cell=(v) DataTypeValidator.validate 'Title.text', Cell, v @cell = v @@ -43,7 +45,7 @@ module Axlsx xml.send('c:title') { xml.send('c:tx') { xml.send('c:strRef') { - xml.send('c:f', range) + xml.send('c:f', Axlsx::cell_range([@cell])) xml.send('c:strCache') { xml.send('c:ptCount', :val=>1) xml.send('c:pt', :idx=>0) { @@ -55,14 +57,5 @@ module Axlsx } end - private - - # returns the excel style abslute reference for the title when title is a Cell object - # @return [String] - def range - return "" unless @data.is_a?(Cell) - "#{@data.row.worksheet.name}!#{data.row.r_abs}" - end - end end diff --git a/lib/axlsx/drawing/two_cell_anchor.rb b/lib/axlsx/drawing/two_cell_anchor.rb index 73e2fe20..06c0554a 100644 --- a/lib/axlsx/drawing/two_cell_anchor.rb +++ b/lib/axlsx/drawing/two_cell_anchor.rb @@ -24,9 +24,6 @@ module Axlsx # @return [Drawing] attr_reader :drawing - # The index of this anchor in the drawing - # @return [Integer] - attr_reader :index # Creates a new TwoCellAnchor object and sets up a reference to the from and to markers in the # graphic_frame's chart. That means that you can do stuff like @@ -51,6 +48,8 @@ module Axlsx @object.chart end + # The index of this anchor in the drawing + # @return [Integer] def index @drawing.anchors.index(self) end diff --git a/lib/axlsx/drawing/val_axis.rb b/lib/axlsx/drawing/val_axis.rb index 10a070f6..3233bcfd 100644 --- a/lib/axlsx/drawing/val_axis.rb +++ b/lib/axlsx/drawing/val_axis.rb @@ -5,7 +5,7 @@ module Axlsx # This element specifies how the value axis crosses the category axis. # must be one of [:between, :midCat] # @return [Symbol] - attr_accessor :crossBetween + attr_reader :crossBetween # Creates a new ValAxis object # @param [Integer] axId the id of this axis @@ -18,7 +18,7 @@ module Axlsx self.crossBetween = :between super(axId, crossAx, options) end - + # @see crossBetween def crossBetween=(v) RestrictionValidator.validate "ValAxis.crossBetween", [:between, :midCat], v; @crossBetween = v; end # Serializes the value axis diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 1065d778..7a8c115f 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -11,30 +11,30 @@ module Axlsx # x rotation for the chart # must be between -90 and 90 # @return [Integer] - attr_accessor :rotX + attr_reader :rotX # height of chart as % of chart # must be between 5% and 500% # @return [String] - attr_accessor :hPercent + attr_reader :hPercent # y rotation for the chart # must be between 0 and 360 # @return [Integer] - attr_accessor :rotY + attr_reader :rotY # depth or chart as % of chart width # must be between 20% and 2000% # @return [String] - attr_accessor :depthPercent + attr_reader :depthPercent # Chart axis are at right angles # @return [Boolean] - attr_accessor :rAngAx + attr_reader :rAngAx # field of view angle # @return [Integer] - attr_accessor :perspective + attr_reader :perspective # Creates a new View3D for charts # @option options [Integer] rotX @@ -44,22 +44,29 @@ module Axlsx # @option options [Boolean] rAngAx # @option options [Integer] perspective def initialize(options={}) + @rotX, @hPercent, @rotY, @depthPercent, @rAngAx, @perspective = nil, nil, nil, nil, nil, nil options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end - def rotX=(v) DataTypeValidator.validate "#{self.class}.rotX", [Integer, Fixnum], v, lambda {|v| v >= -90 && v <= 90 }; @rotX = v; end + # @see rotX + def rotX=(v) DataTypeValidator.validate "#{self.class}.rotX", [Integer, Fixnum], v, lambda {|arg| arg >= -90 && arg <= 90 }; @rotX = v; end + # @see hPercent def hPercent=(v) RegexValidator.validate "#{self.class}.rotX", H_PERCENT_REGEX, v; @hPercent = v; end - def rotY=(v) DataTypeValidator.validate "#{self.class}.rotY", [Integer, Fixnum], v, lambda {|v| v >= 0 && v <= 360 }; @rotY = v; end + # @see rotY + def rotY=(v) DataTypeValidator.validate "#{self.class}.rotY", [Integer, Fixnum], v, lambda {|arg| arg >= 0 && arg <= 360 }; @rotY = v; end + # @see depthPercent def depthPercent=(v) RegexValidator.validate "#{self.class}.depthPercent", DEPTH_PERCENT_REGEX, v; @depthPercent = v; end + # @see rAngAx def rAngAx=(v) Axlsx::validate_boolean(v); @rAngAx = v; end - def perspective=(v) DataTypeValidator.validate "#{self.class}.perspective", [Integer, Fixnum], v, lambda {|v| v >= 0 && v <= 240 }; @perspective = v; end + # @see perspective + def perspective=(v) DataTypeValidator.validate "#{self.class}.perspective", [Integer, Fixnum], v, lambda {|arg| arg >= 0 && arg <= 240 }; @perspective = v; end # Serializes the view3D properties # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 91df81df..d9455f14 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -1,12 +1,23 @@ # -*- coding: utf-8 -*- -# Create Office Open XML Spreadsheets (xlsx) with safe and full control over cell styles, automatically resized column widths and 3D pie charts. module Axlsx # 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. class Package + # Initializes your package + # + # @param [Hash] options A hash that you can use to specify the author and workbook for this package. + # @option options [String] :author The author of the document + # @example Package.new :author => 'you!', :workbook => Workbook.new + def initialize(options={}) + @workbook = nil + @core, @app = Core.new, App.new + @core.creator = options[:author] || @core.creator + yield self if block_given? + end + + # The workbook this package will serialize or validate. - # @attribute # @return [Workbook] If no workbook instance has been assigned with this package a new Workbook instance is returned. # @raise ArgumentError if workbook parameter is not a Workbook instance. # @note As there are multiple ways to instantiate a workbook for the package, @@ -18,25 +29,13 @@ module Axlsx # wb = Pacakge.new().workbook # # # set the workbook after creating the package # wb = Package.new().workbook = Workbook.new - attr_accessor :workbook - - # Initializes your package - # - # @param [Hash] options A hash that you can use to specify the author and workbook for this package. - # @option options [String] :author The author of the document - # @example Package.new :author => 'you!', :workbook => Workbook.new - def initialize(options={}) - @core, @app = Core.new, App.new - @core.creator = options[:author] || @core.creator - yield self if block_given? - end - - def workbook=(workbook) DataTypeValidator.validate "Package.workbook", Workbook, workbook; @workbook = workbook; end - def workbook @workbook || @workbook = Workbook.new end + # @see workbook + def workbook=(workbook) DataTypeValidator.validate "Package.workbook", Workbook, workbook; @workbook = workbook; end + # Serialize your workbook to disk as an xlsx document. # # @param [File] output The file you want to serialize your package to @@ -57,18 +56,17 @@ module Axlsx p = parts Zip::ZipOutputStream.open(output) do |zip| p.each do |part| - zip.put_next_entry(part[:entry]); zip.puts(part[:doc]) unless part[:doc].nil? - end - end - Zip::ZipFile.open(output) do |zip| - p.each do |part| - if part[:path] - zip.add(part[:entry], part[:path], &proc{ true }) + unless part[:doc].nil? + zip.put_next_entry(part[:entry]); + zip.puts(part[:doc]) end - end + unless part[:path].nil? + zip.put_next_entry(part[:entry]); + # binread for 1.9.3 + zip.write IO.respond_to?(:binread) ? IO.binread(part[:path]) : IO.read(part[:path]) + end + end end - - true end diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index a76c0c25..829a724a 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -5,7 +5,7 @@ module Axlsx # The location of the relationship target # @return [String] - attr_accessor :Target + attr_reader :Target # The type of relationship # @note Supported types are defined as constants in Axlsx: @@ -20,13 +20,15 @@ module Axlsx # @see CHART_R # @see DRAWING_R # @return [String] - attr_accessor :Type + attr_reader :Type def initialize(type, target) self.Target=target self.Type=type end + # @see Target def Target=(v) Axlsx::validate_string v; @Target = v end + # @see Type def Type=(v) Axlsx::validate_relationship_type v; @Type = v end # Serializes the relationship diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb index 167b42c9..73a873e5 100644 --- a/lib/axlsx/stylesheet/border.rb +++ b/lib/axlsx/stylesheet/border.rb @@ -3,13 +3,13 @@ module Axlsx class Border # @return [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. - attr_accessor :diagonalUp + attr_reader :diagonalUp # @return [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. - attr_accessor :diagonalDown + attr_reader :diagonalDown # @return [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. - attr_accessor :outline + attr_reader :outline # @return [SimpleTypedList] A list of BorderPr objects for this border. attr_reader :prs @@ -35,8 +35,11 @@ module Axlsx end end + # @see diagonalUp def diagonalUp=(v) Axlsx::validate_boolean v; @diagonalUp = v end + # @see diagonalDown def diagonalDown=(v) Axlsx::validate_boolean v; @diagonalDown = v end + # @see outline def outline=(v) Axlsx::validate_boolean v; @outline = v end # Serializes the border element @@ -44,7 +47,9 @@ module Axlsx 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) } + @prs.select { |pr| pr.name == k }.each do |part| + part.to_xml(xml) + end end } end diff --git a/lib/axlsx/stylesheet/border_pr.rb b/lib/axlsx/stylesheet/border_pr.rb index 63a1f9de..cdab5b13 100644 --- a/lib/axlsx/stylesheet/border_pr.rb +++ b/lib/axlsx/stylesheet/border_pr.rb @@ -3,7 +3,7 @@ module Axlsx class BorderPr # @return [Color] The color of this border part. - attr_accessor :color + attr_reader :color # @return [Symbol] The syle of this border part. # @note @@ -22,7 +22,7 @@ module Axlsx # :dashDotDot # :mediumDashDotDot # :slantDashDot - attr_accessor :style + attr_reader :style # @return [Symbol] The name of this border part # @note @@ -36,7 +36,7 @@ module Axlsx # :diagonal # :vertical # :horizontal - attr_accessor :name + attr_reader :name # Creates a new Border Part Object # @option options [Color] color @@ -49,15 +49,18 @@ module Axlsx end end + # @see name def name=(v) RestrictionValidator.validate "BorderPr.name", [:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal], v; @name = v end + # @see color def color=(v) DataTypeValidator.validate(:color, Color, v); @color = v end + # @see style def style=(v) RestrictionValidator.validate "BorderPr.style", [:none, :thin, :medium, :dashed, :dotted, :thick, :double, :hair, :mediumDashed, :dashDot, :mediumDashDot, :dashDotDot, :mediumDashDotDot, :slantDashDot], v; @style = v end # Serializes the border part # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. # @return [String] def to_xml(xml) - xml.send(@name, :style=>@style) { + xml.send(@name, :style => @style) { @color.to_xml(xml) if @color.is_a? Color } end diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index 071ce68f..75d86e2d 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -15,7 +15,7 @@ module Axlsx # :centerContinuous # :distributed # @return [Symbol] - attr_accessor :horizontal + attr_reader :horizontal # The vertical alignment of the cell. # @note @@ -26,38 +26,38 @@ module Axlsx # :justify # :distributed # @return [Symbol] - attr_accessor :vertical + attr_reader :vertical # The textRotation of the cell. # @return [Integer] - attr_accessor :textRotation + attr_reader :textRotation # Indicate if the text of the cell should wrap # @return [Boolean] - attr_accessor :wrapText + attr_reader :wrapText # The amount of indent # @return [Integer] - attr_accessor :indent + attr_reader :indent # The amount of relativeIndent # @return [Integer] - attr_accessor :relativeIndent + attr_reader :relativeIndent # Indicate if the last line should be justified. # @return [Boolean] - attr_accessor :justifyLastLine + attr_reader :justifyLastLine # Indicate if the text should be shrunk to the fit in the cell. # @return [Boolean] - attr_accessor :shrinkToFit + attr_reader :shrinkToFit # The reading order of the text # 0 Context Dependent # 1 Left-to-Right # 2 Right-to-Left # @return [Integer] - attr_accessor :readingOrder + attr_reader :readingOrder # Create a new cell_alignment object # @option options [Symbol] horizontal @@ -75,14 +75,23 @@ module Axlsx end end + # @see horizontal def horizontal=(v) Axlsx::validate_horizontal_alignment v; @horizontal = v end + # @see vertical def vertical=(v) Axlsx::validate_vertical_alignment v; @vertical = v end + # @see textRotation def textRotation=(v) Axlsx::validate_unsigned_int v; @textRotation = v end + # @see wrapText def wrapText=(v) Axlsx::validate_boolean v; @wrapText = v end + # @see indent def indent=(v) Axlsx::validate_unsigned_int v; @indent = v end + # @see relativeIndent def relativeIndent=(v) Axlsx::validate_int v; @relativeIndent = v end + # @see justifyLastLine def justifyLastLine=(v) Axlsx::validate_boolean v; @justifyLastLine = v end + # @see shrinkToFit def shrinkToFit=(v) Axlsx::validate_boolean v; @shrinkToFit = v end + # @see readingOrder def readingOrder=(v) Axlsx::validate_unsigned_int v; @readingOrder = v end # Serializes the cell alignment diff --git a/lib/axlsx/stylesheet/cell_protection.rb b/lib/axlsx/stylesheet/cell_protection.rb index 7f0f4db8..e1c6183f 100644 --- a/lib/axlsx/stylesheet/cell_protection.rb +++ b/lib/axlsx/stylesheet/cell_protection.rb @@ -6,11 +6,11 @@ module Axlsx # specifies locking for cells that have the style containing this protection # @return [Boolean] - attr_accessor :hidden + attr_reader :hidden # specifies if the cells that have the style containing this protection # @return [Boolean] - attr_accessor :locked + attr_reader :locked # Creates a new CellProtection # @option options [Boolean] hidden value for hidden protection @@ -20,7 +20,10 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end + + # @see hidden def hidden=(v) Axlsx::validate_boolean v; @hidden = v end + # @see locked def locked=(v) Axlsx::validate_boolean v; @locked = v end # Serializes the cell protection diff --git a/lib/axlsx/stylesheet/cell_style.rb b/lib/axlsx/stylesheet/cell_style.rb index 11272075..f11f5193 100644 --- a/lib/axlsx/stylesheet/cell_style.rb +++ b/lib/axlsx/stylesheet/cell_style.rb @@ -5,29 +5,29 @@ module Axlsx class CellStyle # The name of this cell style # @return [String] - attr_accessor :name + attr_reader :name # The formatting record id this named style utilizes # @return [Integer] # @see Axlsx::Xf - attr_accessor :xfId + attr_reader :xfId # The buildinId to use when this named style is applied # @return [Integer] # @see Axlsx::NumFmt - attr_accessor :builtinId + attr_reader :builtinId # Determines if this formatting is for an outline style, and what level of the outline it is to be applied to. # @return [Integer] - attr_accessor :iLevel + attr_reader :iLevel # Determines if this named style should show in the list of styles when using excel # @return [Boolean] - attr_accessor :hidden + attr_reader :hidden # Indicates that the build in style reference has been customized. # @return [Boolean] - attr_accessor :customBuiltin + attr_reader :customBuiltin # Creats a new CellStyle object # @option options [String] name @@ -41,12 +41,17 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end end - + # @see name def name=(v) Axlsx::validate_string v; @name = v end + # @see xfId def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end + # @see builtinId def builtinId=(v) Axlsx::validate_unsigned_int v; @builtinId = v end + # @see iLivel def iLevel=(v) Axlsx::validate_unsigned_int v; @iLevel = v end + # @see hidden def hidden=(v) Axlsx::validate_boolean v; @hidden = v end + # @see customBuiltin def customBuiltin=(v) Axlsx::validate_boolean v; @customBuiltin = v end # Serializes the cell style diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 34567cd1..2df70ee8 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -3,11 +3,11 @@ module Axlsx class Color # Determines if the color is system color dependant # @return [Boolean] - attr_accessor :auto + attr_reader :auto # Backwards compatability color index # return [Integer] - #attr_accessor :indexed + #attr_reader :indexed # The color as defined in rgb terms. # @note @@ -16,16 +16,16 @@ module Axlsx # "FF000000" is black # "FFFFFFFF" is white # @return [String] - attr_accessor :rgb + attr_reader :rgb # no support for theme just yet # @return [Integer] - #attr_accessor :theme + #attr_reader :theme # The tint value. # @note valid values are between -1.0 and 1.0 # @return [Float] - attr_accessor :tint + attr_reader :tint # Creates a new Color object # @option options [Boolean] auto @@ -37,9 +37,11 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end end - + # @see auto def auto=(v) Axlsx::validate_boolean v; @auto = v end + # @see rgb def rgb=(v) Axlsx::validate_string v; @rgb = v end + # @see tint def tint=(v) Axlsx::validate_float v; @tint = v end # This version does not support themes diff --git a/lib/axlsx/stylesheet/fill.rb b/lib/axlsx/stylesheet/fill.rb index b7477a88..ad313679 100644 --- a/lib/axlsx/stylesheet/fill.rb +++ b/lib/axlsx/stylesheet/fill.rb @@ -8,7 +8,7 @@ module Axlsx # The type of fill # @return [PatternFill, GradientFill] - attr_accessor :fill_type + attr_reader :fill_type # Creates a new Fill object # @param [PatternFill, GradientFill] fill_type @@ -24,6 +24,7 @@ module Axlsx xml.fill { @fill_type.to_xml(xml) } end + # @see fill_type def fill_type=(v) DataTypeValidator.validate "Fill.fill_type", [PatternFill, GradientFill], v; @fill_type = v; end diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index fbd369a3..b0c9eaae 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -5,7 +5,7 @@ module Axlsx class Font # The name of the font # @return [String] - attr_accessor :name + attr_reader :name # The charset of the font # @return [Integer] @@ -30,7 +30,7 @@ module Axlsx # 222 THAI_CHARSET # 238 EASTEUROPE_CHARSET # 255 OEM_CHARSET - attr_accessor :charset + attr_reader :charset # The font's family # @note @@ -43,43 +43,43 @@ module Axlsx # 5 Decorative # 6..14 Reserved for future use # @return [Integer] - attr_accessor :family + attr_reader :family # Indicates if the font should be rendered in *bold* # @return [Boolean] - attr_accessor :b + attr_reader :b # Indicates if the font should be rendered italicized # @return [Boolean] - attr_accessor :i + attr_reader :i # Indicates if the font should be rendered with a strikthrough # @return [Boolean] - attr_accessor :strike + attr_reader :strike # Indicates if the font should be rendered with an outline # @return [Boolean] - attr_accessor :outline + attr_reader :outline # Indicates if the font should be rendered with a shadow # @return [Boolean] - attr_accessor :shadow + attr_reader :shadow # Indicates if the font should be condensed # @return [Boolean] - attr_accessor :condense + attr_reader :condense # The font's extend property # @return [Boolean] - attr_accessor :extend + attr_reader :extend # The color of the font # @return [Color] - attr_accessor :color + attr_reader :color # The size of the font. # @return [Integer] - attr_accessor :sz + attr_reader :sz # Creates a new Font # @option options [String] name @@ -100,18 +100,29 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end end - + # @see name def name=(v) Axlsx::validate_string v; @name = v end + # @see charset def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end + # @see family def family=(v) Axlsx::validate_unsigned_int v; @family = v end + # @see b def b=(v) Axlsx::validate_boolean v; @b = v end + # @see i def i=(v) Axlsx::validate_boolean v; @i = v end + # @see strike def strike=(v) Axlsx::validate_boolean v; @strike = v end + # @see outline def outline=(v) Axlsx::validate_boolean v; @outline = v end + # @see shadow def shadow=(v) Axlsx::validate_boolean v; @shadow = v end + # @see condense def condense=(v) Axlsx::validate_boolean v; @condense = v end + # @see extend def extend=(v) Axlsx::validate_boolean v; @extend = v end + # @see color def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end + # @see sz def sz=(v) Axlsx::validate_unsigned_int v; @sz=v end # Serializes the fill diff --git a/lib/axlsx/stylesheet/gradient_fill.rb b/lib/axlsx/stylesheet/gradient_fill.rb index 8fc41a5d..2b02ac76 100644 --- a/lib/axlsx/stylesheet/gradient_fill.rb +++ b/lib/axlsx/stylesheet/gradient_fill.rb @@ -10,27 +10,27 @@ module Axlsx # :linear # :path # @return [Symbol] - attr_accessor :type + attr_reader :type # Angle of the linear gradient # @return [Float] - attr_accessor :degree + attr_reader :degree # Percentage format left # @return [Float] - attr_accessor :left + attr_reader :left # Percentage format right # @return [Float] - attr_accessor :right + attr_reader :right # Percentage format top # @return [Float] - attr_accessor :top + attr_reader :top # Percentage format bottom # @return [Float] - attr_accessor :bottom + attr_reader :bottom # Collection of stop objects # @return [SimpleTypedList] @@ -51,12 +51,18 @@ module Axlsx @stop = SimpleTypedList.new GradientStop end + # @see type def type=(v) Axlsx::validate_gradient_type v; @type = v end + # @see degree def degree=(v) Axlsx::validate_float v; @degree = v end - def left=(v) DataTypeValidator.validate "GradientFill.left", Float, v, lambda { |v| v >= 0.0 && v <= 1.0}; @left = v end - def right=(v) DataTypeValidator.validate "GradientFill.right", Float, v, lambda { |v| v >= 0.0 && v <= 1.0}; @right = v end - def top=(v) DataTypeValidator.validate "GradientFill.top", Float, v, lambda { |v| v >= 0.0 && v <= 1.0}; @top = v end - def bottom=(v) DataTypeValidator.validate "GradientFill.bottom", Float, v, lambda { |v| v >= 0.0 && v <= 1.0}; @bottom= v end + # @see left + def left=(v) DataTypeValidator.validate "GradientFill.left", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @left = v end + # @see right + def right=(v) DataTypeValidator.validate "GradientFill.right", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @right = v end + # @see top + def top=(v) DataTypeValidator.validate "GradientFill.top", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @top = v end + # @see bottom + def bottom=(v) DataTypeValidator.validate "GradientFill.bottom", Float, v, lambda { |arg| arg >= 0.0 && arg <= 1.0}; @bottom= v end # Serializes the gradientFill # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. diff --git a/lib/axlsx/stylesheet/gradient_stop.rb b/lib/axlsx/stylesheet/gradient_stop.rb index 22786fcb..d493c037 100644 --- a/lib/axlsx/stylesheet/gradient_stop.rb +++ b/lib/axlsx/stylesheet/gradient_stop.rb @@ -6,11 +6,11 @@ module Axlsx # The color for this gradient stop # @return [Color] # @see Color - attr_accessor :color + attr_reader :color # The position of the color # @return [Float] - attr_accessor :position + attr_reader :position # Creates a new GradientStop object # @param [Color] color @@ -20,8 +20,10 @@ module Axlsx self.position = position end + # @see color def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color=v end - def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |v| v >= 0 && v <= 1}; @position = v end + # @see position + def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1}; @position = v end # Serializes the gradientStop # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. diff --git a/lib/axlsx/stylesheet/num_fmt.rb b/lib/axlsx/stylesheet/num_fmt.rb index 826599b6..0ed45e5c 100644 --- a/lib/axlsx/stylesheet/num_fmt.rb +++ b/lib/axlsx/stylesheet/num_fmt.rb @@ -37,11 +37,11 @@ module Axlsx # 48 ##0.0E+0 # 49 @ # @see Axlsx - attr_accessor :numFmtId + attr_reader :numFmtId # @return [String] The formatting to use for this number format. # @see http://support.microsoft.com/kb/264372 - attr_accessor :formatCode + attr_reader :formatCode def initialize(options={}) @numFmtId = 0 @formatCode = "" @@ -50,7 +50,9 @@ module Axlsx end end + # @see numFmtId def numFmtId=(v) Axlsx::validate_unsigned_int v; @numFmtId = v end + # @see formatCode def formatCode=(v) Axlsx::validate_string v; @formatCode = v end # Creates a numFmt element applying the instance values of this object as attributes. diff --git a/lib/axlsx/stylesheet/pattern_fill.rb b/lib/axlsx/stylesheet/pattern_fill.rb index 7d674e27..a6a6f6a0 100644 --- a/lib/axlsx/stylesheet/pattern_fill.rb +++ b/lib/axlsx/stylesheet/pattern_fill.rb @@ -6,11 +6,11 @@ module Axlsx # The color to use for the the background in solid fills. # @return [Color] - attr_accessor :fgColor + attr_reader :fgColor # The color to use for the background of the fill when the type is not solid. # @return [Color] - attr_accessor :bgColor + attr_reader :bgColor # The pattern type to use # @note @@ -35,7 +35,7 @@ module Axlsx # :gray125 # :gray0625 # @see Office Open XML Part 1 18.18.55 - attr_accessor :patternType + attr_reader :patternType # Creates a new PatternFill Object # @option options [Symbol] patternType @@ -47,9 +47,11 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end - + # @see fgColor def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor=v end + # @see bgColor def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor=v end + # @see patternType def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end # Serializes the pattern fill diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 6f428ecd..e06a4026 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -197,10 +197,10 @@ module Axlsx 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) @@ -208,7 +208,7 @@ module Axlsx 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? } @@ -218,11 +218,11 @@ module Axlsx else 0 end - - applyProtection = (options[:hidden] || options[:locked]) ? 1 : 0 - + + 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 @@ -230,16 +230,16 @@ module Axlsx if applyProtection xf.protection = CellProtection.new(options) end - + cellXfs << xf - end - + end + # Serializes the styles document # @return [String] 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| + [:numFmts, :fonts, :fills, :borders, :cellStyleXfs, :cellXfs, :cellStyles, :dxfs, :tableStyles].each do |key| self.instance_values[key.to_s].to_xml(xml) end } @@ -280,7 +280,7 @@ module Axlsx @cellStyleXfs.lock @cellStyles = SimpleTypedList.new CellStyle - @cellStyles << CellStyle.new(:name =>"標準", :builtinId =>0, :xfId=>0) + @cellStyles << CellStyle.new(:name =>"Normal", :builtinId =>0, :xfId=>0) @cellStyles.lock @cellXfs = SimpleTypedList.new Xf, "cellXfs" diff --git a/lib/axlsx/stylesheet/table_style.rb b/lib/axlsx/stylesheet/table_style.rb index ca138b1f..77fbd448 100644 --- a/lib/axlsx/stylesheet/table_style.rb +++ b/lib/axlsx/stylesheet/table_style.rb @@ -5,15 +5,15 @@ module Axlsx # The name of this table style # @return [string] - attr_accessor :name + attr_reader :name # indicates if this style should be applied to pivot tables # @return [Boolean] - attr_accessor :pivot + attr_reader :pivot # indicates if this style should be applied to tables # @return [Boolean] - attr_accessor :table + attr_reader :table # creates a new TableStyle object # @raise [ArgumentError] if name option is not provided. @@ -28,8 +28,11 @@ module Axlsx super TableStyleElement end + # @see name def name=(v) Axlsx::validate_string v; @name=v end + # @see pivot def pivot=(v) Axlsx::validate_boolean v; @pivot=v end + # @see table def table=(v) Axlsx::validate_boolean v; @table=v end # Serializes the table style diff --git a/lib/axlsx/stylesheet/table_style_element.rb b/lib/axlsx/stylesheet/table_style_element.rb index 146a6bad..20159788 100644 --- a/lib/axlsx/stylesheet/table_style_element.rb +++ b/lib/axlsx/stylesheet/table_style_element.rb @@ -32,15 +32,15 @@ module Axlsx # :pageFieldLabels # :pageFieldValues # @return [Symbol] - attr_accessor :type + attr_reader :type # Number of rows or columns used in striping when the type is firstRowStripe, secondRowStripe, firstColumnStripe, or secondColumnStripe. # @return [Integer] - attr_accessor :size + attr_reader :size # The dxfId this style element points to # @return [Integer] - attr_accessor :dxfId + attr_reader :dxfId # creates a new TableStyleElement object # @option options [Symbol] type @@ -51,9 +51,14 @@ module Axlsx self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end end - + + # @see type def type=(v) Axlsx::validate_table_element_type v; @type = v end + + # @see size def size=(v) Axlsx::validate_unsigned_int v; @size = v end + + # @see dxfId def dxfId=(v) Axlsx::validate_unsigned_int v; @dxfId = v end # Serializes the table style element diff --git a/lib/axlsx/stylesheet/table_styles.rb b/lib/axlsx/stylesheet/table_styles.rb index cc2005f6..bfd15261 100644 --- a/lib/axlsx/stylesheet/table_styles.rb +++ b/lib/axlsx/stylesheet/table_styles.rb @@ -5,12 +5,11 @@ module Axlsx # The default table style. The default value is 'TableStyleMedium9' # @return [String] - # - attr_accessor :defaultTableStyle + attr_reader :defaultTableStyle # The default pivot table style. The default value is 'PivotStyleLight6' # @return [String] - attr_accessor :defaultPivotStyle + attr_reader :defaultPivotStyle # Creates a new TableStyles object that is a container for TableStyle objects # @option options [String] defaultTableStyle @@ -20,8 +19,9 @@ module Axlsx @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16" super TableStyle end - + # @see defaultTableStyle def defaultTableStyle=(v) Axlsx::validate_string(v); @defaultTableStyle = v; end + # @see defaultPivotStyle def defaultPivotStyle=(v) Axlsx::validate_string(v); @defaultPivotStyle = v; end # Serializes the table styles element diff --git a/lib/axlsx/stylesheet/xf.rb b/lib/axlsx/stylesheet/xf.rb index 905eda2c..3ca1a8a2 100644 --- a/lib/axlsx/stylesheet/xf.rb +++ b/lib/axlsx/stylesheet/xf.rb @@ -1,107 +1,128 @@ module Axlsx - # The Xf class defines a formatting record for use in Styles + # The Xf class defines a formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style + # @see Styles#add_style class Xf #does not support extList (ExtensionList) # The cell alignment for this style # @return [CellAlignment] # @see CellAlignment - attr_accessor :alignment + attr_reader :alignment # The cell protection for this style # @return [CellProtection] # @see CellProtection - attr_accessor :protection + attr_reader :protection # id of the numFmt to apply to this style # @return [Integer] - attr_accessor :numFmtId + attr_reader :numFmtId # index (0 based) of the font to be used in this style # @return [Integer] - attr_accessor :fontId + attr_reader :fontId # index (0 based) of the fill to be used in this style # @return [Integer] - attr_accessor :fillId + attr_reader :fillId # index (0 based) of the border to be used in this style # @return [Integer] - attr_accessor :borderId + attr_reader :borderId # index (0 based) of cellStylesXfs item to be used in this style. Only applies to cellXfs items # @return [Integer] - attr_accessor :xfId + attr_reader :xfId # indecates if text should be prefixed by a single quote in the cell # @return [Boolean] - attr_accessor :quotePrefix + attr_reader :quotePrefix # indicates if the cell has a pivot table drop down button # @return [Boolean] - attr_accessor :pivotButton + attr_reader :pivotButton # indicates if the numFmtId should be applied # @return [Boolean] - attr_accessor :applyNumberFormat + attr_reader :applyNumberFormat # indicates if the fontId should be applied # @return [Boolean] - attr_accessor :applyFont + attr_reader :applyFont # indicates if the fillId should be applied # @return [Boolean] - attr_accessor :applyFill + attr_reader :applyFill # indicates if the borderId should be applied # @return [Boolean] - attr_accessor :applyBorder + attr_reader :applyBorder # Indicates if the alignment options should be applied # @return [Boolean] - attr_accessor :applyAlignment + attr_reader :applyAlignment # Indicates if the protection options should be applied # @return [Boolean] - attr_accessor :applyProtection + attr_reader :applyProtection # Creates a new Xf object - # @option [Integer] numFmtId - # @option [Integer] fontId - # @option [Integer] fillId - # @option [Integer] borderId - # @option [Integer] xfId - # @option [Boolean] quotePrefix - # @option [Boolean] pivotButton - # @option [Boolean] applyNumberFormat - # @option [Boolean] applyFont - # @option [Boolean] applyFill - # @option [Boolean] applyBorder - # @option [Boolean] applyAlignment - # @option [Boolean] applyProtection - # @option [CellAlignment] alignment - # @option [CellProtection] protection + # @option options [Integer] numFmtId + # @option options [Integer] fontId + # @option options [Integer] fillId + # @option options [Integer] borderId + # @option options [Integer] xfId + # @option options [Boolean] quotePrefix + # @option options [Boolean] pivotButton + # @option options [Boolean] applyNumberFormat + # @option options [Boolean] applyFont + # @option options [Boolean] applyFill + # @option options [Boolean] applyBorder + # @option options [Boolean] applyAlignment + # @option options [Boolean] applyProtection + # @option options [CellAlignment] alignment + # @option options [CellProtection] protection def initialize(options={}) options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end + # @see Xf#alignment def alignment=(v) DataTypeValidator.validate "Xf.alignment", CellAlignment, v; @alignment = v end + + # @see protection def protection=(v) DataTypeValidator.validate "Xf.protection", CellProtection, v; @protection = v end + # @see numFmtId def numFmtId=(v) Axlsx::validate_unsigned_int v; @numFmtId = v end + + # @see fontId def fontId=(v) Axlsx::validate_unsigned_int v; @fontId = v end + # @see fillId def fillId=(v) Axlsx::validate_unsigned_int v; @fillId = v end + # @see borderId def borderId=(v) Axlsx::validate_unsigned_int v; @borderId = v end + # @see xfId def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end + # @see quotePrefix def quotePrefix=(v) Axlsx::validate_boolean v; @quotePrefix = v end + # @see pivotButton def pivotButton=(v) Axlsx::validate_boolean v; @pivotButton = v end + # @see applyNumberFormat def applyNumberFormat=(v) Axlsx::validate_boolean v; @applyNumberFormat = v end + # @see applyFont def applyFont=(v) Axlsx::validate_boolean v; @applyFont = v end + # @see applyFill def applyFill=(v) Axlsx::validate_boolean v; @applyFill = v end + + # @see applyBorder def applyBorder=(v) Axlsx::validate_boolean v; @applyBorder = v end + + # @see applyAlignment def applyAlignment=(v) Axlsx::validate_boolean v; @applyAlignment = v end + + # @see applyProtection def applyProtection=(v) Axlsx::validate_boolean v; @applyProtection = v end # Serializes the xf elemen diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 827030c7..5e590bbe 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -31,7 +31,7 @@ module Axlsx # @raise [ArugumentError] Raised if the class of the value provided is not in the specified array of types or the block passed returns false # @return [Boolean] true if validation succeeds. # @see validate_boolean - def self.validate(name, types, v, other= lambda{|v| true }) + def self.validate(name, types, v, other= lambda{|arg| true }) types = [types] unless types.is_a? Array valid_type = false if v.class == Class @@ -49,7 +49,7 @@ module Axlsx # @raise [ArgumentError] raised if the value is not a Fixnum or Integer value greater or equal to 0 # @return [Boolean] true if the data is valid def self.validate_unsigned_int(v) - DataTypeValidator.validate(:unsigned_int, [Fixnum, Integer], v, lambda { |v| v.respond_to?(:>=) && v >= 0 }) + DataTypeValidator.validate(:unsigned_int, [Fixnum, Integer], v, lambda { |arg| arg.respond_to?(:>=) && arg >= 0 }) end # Requires that the value is a Fixnum or Integer @@ -63,7 +63,7 @@ module Axlsx # it must be one of 0, 1, "true", "false", :true, :false, true, false, "0", or "1" # @param [Any] v The value validated 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) }) + DataTypeValidator.validate(:boolean, [Fixnum, String, Integer, Symbol, TrueClass, FalseClass], v, lambda { |arg| [0, 1, "true", "false", :true, :false, true, false, "0", "1"].include?(arg) }) end # Requires that the value is a String diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb index ed7a1ff1..2ecaf2a9 100644 --- a/lib/axlsx/version.rb +++ b/lib/axlsx/version.rb @@ -1,4 +1,4 @@ module Axlsx # version - VERSION="1.0.8" + VERSION="1.0.9" end diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 76a3803c..68f9f8b8 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -65,13 +65,6 @@ require 'axlsx/workbook/worksheet/worksheet.rb' # @return [Styles] attr_reader :styles - # The workbook relationships. This is managed automatically by the workbook - # @return [Relationships] - attr_reader :relationships - - # Instance level access to the class variable 1904 - # @return [Boolean] - attr_accessor :date1904 # Indicates if the epoc date for serialization should be 1904. If false, 1900 is used. @@ -89,9 +82,13 @@ require 'axlsx/workbook/worksheet/worksheet.rb' yield self if block_given? end - def date1904=(v) Axlsx::validate_boolean v; @@date1904 = v; end + # Instance level access to the class variable 1904 + # @return [Boolean] def date1904() @@date1904; end + # see @date1904 + def date1904=(v) Axlsx::validate_boolean v; @@date1904 = v; end + # Sets the date1904 attribute to the provided boolean # @return [Boolean] def self.date1904=(v) Axlsx::validate_boolean v; @@date1904 = v; end @@ -109,7 +106,9 @@ require 'axlsx/workbook/worksheet/worksheet.rb' yield worksheet if block_given? worksheet end - + + # The workbook relationships. This is managed automatically by the workbook + # @return [Relationships] def relationships r = Relationships.new @worksheets.each do |sheet| diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 5e535721..556a5a89 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- module Axlsx # 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. @@ -25,7 +26,7 @@ module Axlsx # The index of the cellXfs item to be applied to this cell. # @return [Integer] # @see Axlsx::Styles - attr_accessor :style + attr_reader :style # The row this cell belongs to. # @return [Row] @@ -42,12 +43,24 @@ module Axlsx # :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. - # - attr_accessor :type + attr_reader :type + # @see type + def type=(v) + RestrictionValidator.validate "Cell.type", [:time, :float, :integer, :string], v + @type=v + self.value = @value + end + # The value of this cell. # @return casted value based on cell's type attribute. - attr_accessor :value + attr_reader :value + # @see value + def value=(v) + #TODO: consider doing value based type determination first? + @value = cast_value(v) + end + # @param [Row] row The row this cell belongs to. # @param [Any] value The value associated with this cell. @@ -91,16 +104,7 @@ module Axlsx @style = v end - def type=(v) - RestrictionValidator.validate "Cell.type", [:time, :float, :integer, :string], v - @type=v - self.value = @value - end - def value=(v) - #TODO: consider doing value based type determination first? - @value = cast_value(v) - end # Serializes the cell # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. @@ -108,14 +112,19 @@ module Axlsx # @note # Shared Strings are not used in this library. All values are set directly in the each sheet. 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.to_s } } + # Both 1.8 and 1.9 return the same 'fast_xf' + # ニホンゴ + # ニホンゴ + + # however nokogiri does a nice 'force_encoding' which we shall remove! + if @type == :string + xml.c(:r => r, :t=>:inlineStr, :s=>style) { xml.is { xml.t @value.to_s } } else xml.c(:r => r, :s => style) { xml.v value } end end + private # assigns the owning row for this cell. diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 27e60f38..96a1c3d1 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -12,10 +12,6 @@ module Axlsx # @return [SimpleTypedList] attr_reader :cells - # The index of this row in the worksheet - # @return [Integer] - attr_reader :index - # 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. @@ -37,6 +33,8 @@ module Axlsx array_to_cells(values, options) end + # The index of this row in the worksheet + # @return [Integer] def index worksheet.rows.index(self) end diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 861bb8ef..6dfbc060 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -6,49 +6,24 @@ module Axlsx # The name of the worksheet # @return [String] - attr_accessor :name + attr_reader :name # The workbook that owns this worksheet # @return [Workbook] attr_reader :workbook - # The worksheet relationships. This is managed automatically by the worksheet - # @return [Relationships] - attr_reader :relationships # The rows in this worksheet # @note The recommended way to manage rows is Worksheet#add_row # @return [SimpleTypedList] # @see Worksheet#add_row attr_reader :rows - - # The drawing associated with this worksheet. - # @note the recommended way to work with drawings and charts is Worksheet#add_chart - # @return [Drawing] - # @see Worksheet#add_chart - attr_reader :drawing # An array of content based calculated column widths. # @note a single auto fit data item is a hash with :longest => [String] and :sz=> [Integer] members. # @return [Array] of Hash attr_reader :auto_fit_data - # The part name of this worksheet - # @return [String] - attr_reader :pn - - # The relationship part name of this worksheet - # @return [String] - attr_reader :rels_pn - - # The relationship Id of thiw worksheet - # @return [String] - attr_reader :rId - - # The index of this worksheet in the owning Workbook's worksheets list. - # @return [Integer] - attr_reader :index - # TODO Merge Cells # attr_reader :merge_cells @@ -57,6 +32,7 @@ module Axlsx # @see Workbook#add_worksheet # @option options [String] name The name of this sheet. def initialize(wb, options={}) + @drawing = nil @rows = SimpleTypedList.new Row self.workbook = wb @workbook.worksheets << self @@ -65,25 +41,38 @@ module Axlsx @magick_draw = Magick::Draw.new end - + # The name of the worksheet + # @param [String] v def name=(v) DataTypeValidator.validate "Worksheet.name", String, v; @name=v end - + + # The part name of this worksheet + # @return [String] def pn "#{WORKSHEET_PN % (index+1)}" end + # The relationship part name of this worksheet + # @return [String] def rels_pn "#{WORKSHEET_RELS_PN % (index+1)}" end + # The relationship Id of thiw worksheet + # @return [String] def rId "rId#{index+1}" end - + + # The index of this worksheet in the owning Workbook's worksheets list. + # @return [Integer] def index @workbook.worksheets.index(self) end + # The drawing associated with this worksheet. + # @note the recommended way to work with drawings and charts is Worksheet#add_chart + # @return [Drawing] + # @see Worksheet#add_chart def drawing @drawing || @drawing = Axlsx::Drawing.new(self) end @@ -149,10 +138,11 @@ module Axlsx xml.drawing :"r:id"=>"rId1" if @drawing } end - builder.to_xml(:indent=>0, :save_with=>0) + builder.to_xml end - # The worksheet's relationships. + # The worksheet relationships. This is managed automatically by the worksheet + # @return [Relationships] def relationships r = Relationships.new r << Relationship.new(DRAWING_R, "../#{@drawing.pn}") if @drawing @@ -193,7 +183,7 @@ module Axlsx # 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 + # width = Truncate([!{Number of Characters} * !{Maximum Digit Width} + !{5 pixel padding}]/!{Maximum Digit Width}*256)/256 # @return [Float] # @param [Hash] A hash of auto_fit_data def auto_width(col) @@ -201,6 +191,7 @@ module Axlsx 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 diff --git a/test/drawing/tc_one_cell_anchor.rb b/test/drawing/tc_one_cell_anchor.rb index d2618622..cab22840 100644 --- a/test/drawing/tc_one_cell_anchor.rb +++ b/test/drawing/tc_one_cell_anchor.rb @@ -30,7 +30,7 @@ class TestOneCellAnchor < Test::Unit::TestCase end def test_index - assert(@anchor.index, @anchor.drawing.anchors.index(@anchor)) + assert_equal(@anchor.index, @anchor.drawing.anchors.index(@anchor)) end def test_width -- cgit v1.2.3