xlsxrb 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +88 -0
- data/README.md +25 -3
- data/lib/xlsxrb/dsl_helpers.rb +65 -1
- data/lib/xlsxrb/elements/styles.rb +15 -6
- data/lib/xlsxrb/elements/worksheet.rb +2 -2
- data/lib/xlsxrb/number_formatter.rb +26 -8
- data/lib/xlsxrb/ooxml/cfb.rb +11 -3
- data/lib/xlsxrb/ooxml/crypto/agile.rb +48 -10
- data/lib/xlsxrb/ooxml/crypto/standard.rb +5 -1
- data/lib/xlsxrb/ooxml/crypto.rb +3 -0
- data/lib/xlsxrb/ooxml/shared_strings_parser.rb +26 -8
- data/lib/xlsxrb/ooxml/utils.rb +13 -0
- data/lib/xlsxrb/ooxml/workbook_writer.rb +43 -21
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +116 -12
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +338 -259
- data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +206 -201
- data/lib/xlsxrb/ooxml/writer/features_xml.rb +109 -102
- data/lib/xlsxrb/ooxml/writer/styles_xml.rb +46 -46
- data/lib/xlsxrb/ooxml/writer.rb +167 -160
- data/lib/xlsxrb/ooxml/xml_builder.rb +35 -7
- data/lib/xlsxrb/ooxml/xml_parser.rb +34 -1
- data/lib/xlsxrb/ooxml/zip_reader.rb +95 -68
- data/lib/xlsxrb/ooxml/zip_writer.rb +16 -0
- data/lib/xlsxrb/stream_row.rb +2 -2
- data/lib/xlsxrb/stream_sheet.rb +26 -11
- data/lib/xlsxrb/stream_writer.rb +212 -86
- data/lib/xlsxrb/style_builder.rb +339 -0
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +239 -88
- data/lib/xlsxrb/worksheet_builder.rb +847 -139
- data/lib/xlsxrb.rb +87 -21
- data/sig/generated/xlsxrb/dsl_helpers.rbs +37 -0
- data/sig/generated/xlsxrb/elements/styles.rbs +5 -0
- data/sig/generated/xlsxrb/number_formatter.rbs +7 -0
- data/sig/generated/xlsxrb/ooxml/cfb.rbs +2 -0
- data/sig/generated/xlsxrb/ooxml/crypto/agile.rbs +10 -0
- data/sig/generated/xlsxrb/ooxml/shared_strings_parser.rbs +7 -0
- data/sig/generated/xlsxrb/ooxml/utils.rbs +10 -0
- data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +13 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +40 -0
- data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +53 -0
- data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +3 -0
- data/sig/generated/xlsxrb/ooxml/writer.rbs +4 -0
- data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +19 -2
- data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +10 -0
- data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +12 -1
- data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +8 -0
- data/sig/generated/xlsxrb/stream_row.rbs +2 -2
- data/sig/generated/xlsxrb/stream_sheet.rbs +9 -0
- data/sig/generated/xlsxrb/stream_writer.rbs +46 -6
- data/sig/generated/xlsxrb/style_builder.rbs +261 -0
- data/sig/generated/xlsxrb/workbook_builder.rbs +42 -9
- data/sig/generated/xlsxrb/worksheet_builder.rbs +618 -4
- data/sig/generated/xlsxrb.rbs +53 -8
- metadata +9 -3
|
@@ -645,6 +645,15 @@ module Xlsxrb
|
|
|
645
645
|
# : () -> String
|
|
646
646
|
def raw_sheet_xml: () -> String
|
|
647
647
|
|
|
648
|
+
DIMENSION_SCAN_LIMIT: untyped
|
|
649
|
+
|
|
650
|
+
DIMENSION_RE: ::Regexp
|
|
651
|
+
|
|
652
|
+
# Returns the ref of the <dimension> element in +xml+, or nil. Text that is not valid
|
|
653
|
+
# UTF-8 is searched as bytes.
|
|
654
|
+
# : (String xml) -> String?
|
|
655
|
+
def dimension_ref_in: (String xml) -> String?
|
|
656
|
+
|
|
648
657
|
# Extracts dimension reference from XML source lazily without parsing the entire file.
|
|
649
658
|
# : () -> String?
|
|
650
659
|
def extract_dimension: () -> String?
|
|
@@ -110,6 +110,8 @@ module Xlsxrb
|
|
|
110
110
|
# @yield [style_builder]
|
|
111
111
|
# @yieldparam style_builder [Xlsxrb::StyleBuilder]
|
|
112
112
|
# @return [StyleBuilder]
|
|
113
|
+
# Using the returned value is deprecated and warns; in version 0.3.0, this method
|
|
114
|
+
# will return nil. Configure the style with options or in the block.
|
|
113
115
|
# : (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
|
|
114
116
|
def style: (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
|
|
115
117
|
|
|
@@ -875,7 +877,9 @@ module Xlsxrb
|
|
|
875
877
|
|
|
876
878
|
# Sets the worksheet background image (<picture>).
|
|
877
879
|
#
|
|
878
|
-
# @param val [String, Hash, Elements::Image, nil] Image binary data,
|
|
880
|
+
# @param val [String, Hash, Elements::Image, nil] Image binary data, or a Hash with +:data+ and
|
|
881
|
+
# +:ext+. A String is always the image itself: to use a file, pass its bytes, as in
|
|
882
|
+
# +{ data: File.binread(path), ext: "jpg" }+.
|
|
879
883
|
# @return [untyped]
|
|
880
884
|
# @api public
|
|
881
885
|
# : (untyped val) -> untyped
|
|
@@ -1029,6 +1033,13 @@ module Xlsxrb
|
|
|
1029
1033
|
# @api public
|
|
1030
1034
|
# : (Hash[Symbol, untyped]? spec) -> Hash[Symbol, untyped]?
|
|
1031
1035
|
def sheet_calc_properties=: (Hash[Symbol, untyped]? spec) -> Hash[Symbol, untyped]?
|
|
1036
|
+
|
|
1037
|
+
private
|
|
1038
|
+
|
|
1039
|
+
# The error for writing through a proxy whose sheet is not the current sheet: an
|
|
1040
|
+
# earlier sheet, or a sheet that was never created.
|
|
1041
|
+
# : () -> Error
|
|
1042
|
+
def inactive_sheet_error: () -> Error
|
|
1032
1043
|
end
|
|
1033
1044
|
|
|
1034
1045
|
# Returns the list of worksheet names created in this workbook so far.
|
|
@@ -1052,8 +1063,13 @@ module Xlsxrb
|
|
|
1052
1063
|
# : (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetProxy) -> void } -> String
|
|
1053
1064
|
def sheet: (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetProxy) -> void } -> String
|
|
1054
1065
|
|
|
1066
|
+
UNKNOWN_SHEET_MESSAGE: ::String
|
|
1067
|
+
|
|
1055
1068
|
# Returns a WorksheetProxy for the current or named sheet.
|
|
1056
1069
|
#
|
|
1070
|
+
# Looking up a sheet that does not exist is deprecated and warns; in version 0.3.0 it
|
|
1071
|
+
# will raise ArgumentError.
|
|
1072
|
+
#
|
|
1057
1073
|
# @param name_or_index [String, Symbol, Integer, nil] Sheet name or 0-based sheet index.
|
|
1058
1074
|
# @yield [proxy]
|
|
1059
1075
|
# @yieldparam proxy [WorksheetProxy]
|
|
@@ -1579,7 +1595,9 @@ module Xlsxrb
|
|
|
1579
1595
|
|
|
1580
1596
|
# Sets the worksheet background image (<picture>).
|
|
1581
1597
|
#
|
|
1582
|
-
# @param val [String, Hash, Elements::Image, nil] Image binary data,
|
|
1598
|
+
# @param val [String, Hash, Elements::Image, nil] Image binary data, or a Hash with +:data+ and
|
|
1599
|
+
# +:ext+. A String is always the image itself: to use a file, pass its bytes, as in
|
|
1600
|
+
# +{ data: File.binread(path), ext: "jpg" }+.
|
|
1583
1601
|
# @return [untyped]
|
|
1584
1602
|
# @api public
|
|
1585
1603
|
# : (untyped val) -> untyped
|
|
@@ -1998,10 +2016,32 @@ module Xlsxrb
|
|
|
1998
2016
|
# : (untyped cell_styles) -> void
|
|
1999
2017
|
def check_style_names!: (untyped cell_styles) -> void
|
|
2000
2018
|
|
|
2001
|
-
#
|
|
2002
|
-
#
|
|
2003
|
-
#
|
|
2004
|
-
|
|
2019
|
+
# Raises ArgumentError if +name+ is a style name that has not been defined. Defined
|
|
2020
|
+
# names return before DslHelpers.check_style_name!, whose Symbol#to_s allocates a
|
|
2021
|
+
# String for every styled cell.
|
|
2022
|
+
# : (untyped name) -> void
|
|
2023
|
+
def check_style_name!: (untyped name) -> void
|
|
2024
|
+
|
|
2025
|
+
LATE_SHEET_SETTING_MESSAGE: ::String
|
|
2026
|
+
|
|
2027
|
+
# Warns when a setting that StreamWriter writes at the start of the sheet comes after
|
|
2028
|
+
# rows (or skipped rows) of the sheet. ADR 0010 makes it an error in 0.3.0.
|
|
2029
|
+
# : (String name) -> void
|
|
2030
|
+
def warn_late_sheet_setting: (String name) -> void
|
|
2031
|
+
|
|
2032
|
+
# The style id for a Time-like value (see Ooxml::WorksheetWriter::TimeLike) in a cell
|
|
2033
|
+
# whose style id is style_id: the date-time variant of that style when the style has no
|
|
2034
|
+
# number format, as a Time in the same cell gets from with_date_style_variants, and
|
|
2035
|
+
# style_id otherwise. Called by the worksheet writer only for such values.
|
|
2036
|
+
# : (Integer style_id) -> Integer
|
|
2037
|
+
def time_like_style_id: (Integer style_id) -> Integer
|
|
2038
|
+
|
|
2039
|
+
# Gives Date and Time values whose named style has no number format a variant of that
|
|
2040
|
+
# style with the default date or time format, registered on first use. A value without
|
|
2041
|
+
# a cell style gets a variant of the style it inherits: the row style, or the column
|
|
2042
|
+
# style in a row without one.
|
|
2043
|
+
# : (Array[untyped] values, untyped cell_styles, untyped row_style) -> untyped
|
|
2044
|
+
def with_date_style_variants: (Array[untyped] values, untyped cell_styles, untyped row_style) -> untyped
|
|
2005
2045
|
|
|
2006
2046
|
def ensure_sheet_started!: () -> untyped
|
|
2007
2047
|
|
|
@@ -572,6 +572,17 @@ module Xlsxrb
|
|
|
572
572
|
# : (untyped writer) -> Integer
|
|
573
573
|
def register_with: (untyped writer) -> Integer
|
|
574
574
|
|
|
575
|
+
# Returns whether +other+ describes the same cell format, whatever the names.
|
|
576
|
+
#
|
|
577
|
+
# @param other [StyleBuilder]
|
|
578
|
+
# @return [Boolean]
|
|
579
|
+
# @api private
|
|
580
|
+
# : (StyleBuilder other) -> bool
|
|
581
|
+
def same_format?: (StyleBuilder other) -> bool
|
|
582
|
+
|
|
583
|
+
# : () -> Array[untyped]
|
|
584
|
+
def format_signature: () -> Array[untyped]
|
|
585
|
+
|
|
575
586
|
private
|
|
576
587
|
|
|
577
588
|
# Raises ArgumentError for option keys #apply_options! does not know, and for a nested
|
|
@@ -583,4 +594,254 @@ module Xlsxrb
|
|
|
583
594
|
|
|
584
595
|
def resolve_color: (untyped color) -> untyped
|
|
585
596
|
end
|
|
597
|
+
|
|
598
|
+
# What +style+ returns in the 0.2 series, in place of the definition it records. It
|
|
599
|
+
# forwards every public method to that definition, so changes still reach it, and warns
|
|
600
|
+
# on first use at the caller's line.
|
|
601
|
+
#
|
|
602
|
+
# @deprecated Configure a style with options or in the block given to +style+. In version
|
|
603
|
+
# 0.3.0, +style+ will return nil (ADR 0010).
|
|
604
|
+
# @api public
|
|
605
|
+
class ReturnedStyleBuilder < StyleBuilder
|
|
606
|
+
DEPRECATION_MESSAGE: ::String
|
|
607
|
+
|
|
608
|
+
# @api private
|
|
609
|
+
# : (StyleBuilder definition) -> void
|
|
610
|
+
def initialize: (StyleBuilder definition) -> void
|
|
611
|
+
|
|
612
|
+
# : () -> (String | Symbol)?
|
|
613
|
+
def name: () -> (String | Symbol)?
|
|
614
|
+
|
|
615
|
+
# : () -> Hash[Symbol, untyped]
|
|
616
|
+
def font_props: () -> Hash[Symbol, untyped]
|
|
617
|
+
|
|
618
|
+
# : () -> Hash[Symbol, untyped]
|
|
619
|
+
def fill_props: () -> Hash[Symbol, untyped]
|
|
620
|
+
|
|
621
|
+
# : () -> Hash[Symbol, untyped]
|
|
622
|
+
def border_props: () -> Hash[Symbol, untyped]
|
|
623
|
+
|
|
624
|
+
# : (String name, String | Integer number_format) -> StyleBuilder
|
|
625
|
+
def with_number_format: (String name, String | Integer number_format) -> StyleBuilder
|
|
626
|
+
|
|
627
|
+
# : (**untyped) -> self
|
|
628
|
+
def apply_options!: (**untyped) -> self
|
|
629
|
+
|
|
630
|
+
# : (**untyped) -> void
|
|
631
|
+
def font: (**untyped) -> void
|
|
632
|
+
|
|
633
|
+
# : (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
634
|
+
def font=: (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
635
|
+
|
|
636
|
+
# : (bool value) -> bool
|
|
637
|
+
def bold=: (bool value) -> bool
|
|
638
|
+
|
|
639
|
+
# : () -> bool
|
|
640
|
+
def bold?: () -> bool
|
|
641
|
+
|
|
642
|
+
# : (bool value) -> bool
|
|
643
|
+
def italic=: (bool value) -> bool
|
|
644
|
+
|
|
645
|
+
# : () -> bool
|
|
646
|
+
def italic?: () -> bool
|
|
647
|
+
|
|
648
|
+
# : () -> (Integer | Float | nil)
|
|
649
|
+
def font_size: () -> (Integer | Float | nil)
|
|
650
|
+
|
|
651
|
+
# : (Numeric size_value) -> Numeric
|
|
652
|
+
def font_size=: (Numeric size_value) -> Numeric
|
|
653
|
+
|
|
654
|
+
# : () -> String?
|
|
655
|
+
def font_name: () -> String?
|
|
656
|
+
|
|
657
|
+
# : (String name) -> String
|
|
658
|
+
def font_name=: (String name) -> String
|
|
659
|
+
|
|
660
|
+
# : () -> String?
|
|
661
|
+
def font_color: () -> String?
|
|
662
|
+
|
|
663
|
+
# : (String | Symbol color) -> (String | Symbol)
|
|
664
|
+
def font_color=: (String | Symbol color) -> (String | Symbol)
|
|
665
|
+
|
|
666
|
+
# : () -> (String | Symbol | bool | nil)
|
|
667
|
+
def underline: () -> (String | Symbol | bool | nil)
|
|
668
|
+
|
|
669
|
+
# : (String | Symbol | bool val) -> (String | Symbol | bool)
|
|
670
|
+
def underline=: (String | Symbol | bool val) -> (String | Symbol | bool)
|
|
671
|
+
|
|
672
|
+
# : () -> bool
|
|
673
|
+
def underline?: () -> bool
|
|
674
|
+
|
|
675
|
+
# : (bool value) -> bool
|
|
676
|
+
def strike=: (bool value) -> bool
|
|
677
|
+
|
|
678
|
+
# : () -> bool
|
|
679
|
+
def strike?: () -> bool
|
|
680
|
+
|
|
681
|
+
# : () -> String?
|
|
682
|
+
def vert_align: () -> String?
|
|
683
|
+
|
|
684
|
+
# : (untyped val) -> untyped
|
|
685
|
+
def vert_align=: (untyped val) -> untyped
|
|
686
|
+
|
|
687
|
+
# : (untyped val) -> untyped
|
|
688
|
+
def superscript=: (untyped val) -> untyped
|
|
689
|
+
|
|
690
|
+
# : () -> bool
|
|
691
|
+
def superscript?: () -> bool
|
|
692
|
+
|
|
693
|
+
# : (untyped val) -> untyped
|
|
694
|
+
def subscript=: (untyped val) -> untyped
|
|
695
|
+
|
|
696
|
+
# : () -> bool
|
|
697
|
+
def subscript?: () -> bool
|
|
698
|
+
|
|
699
|
+
# : (?untyped pattern, ?fg_color: String | Symbol | nil, ?bg_color: String | Symbol | nil) -> void
|
|
700
|
+
def fill_pattern: (?untyped pattern, ?fg_color: String | Symbol | nil, ?bg_color: String | Symbol | nil) -> void
|
|
701
|
+
|
|
702
|
+
# : (untyped pattern) -> untyped
|
|
703
|
+
def fill_pattern=: (untyped pattern) -> untyped
|
|
704
|
+
|
|
705
|
+
# : () -> String?
|
|
706
|
+
def fill_color: () -> String?
|
|
707
|
+
|
|
708
|
+
# : (String | Symbol color) -> (String | Symbol)
|
|
709
|
+
def fill_color=: (String | Symbol color) -> (String | Symbol)
|
|
710
|
+
|
|
711
|
+
# : (?pattern: untyped, ?fg_color: String | Symbol | nil, ?bg_color: String | Symbol | nil) -> void
|
|
712
|
+
def fill: (?pattern: untyped, ?fg_color: String | Symbol | nil, ?bg_color: String | Symbol | nil) -> void
|
|
713
|
+
|
|
714
|
+
# : (untyped opts) -> untyped
|
|
715
|
+
def fill=: (untyped opts) -> untyped
|
|
716
|
+
|
|
717
|
+
# : (?type: untyped, ?degree: Numeric | nil, ?stops: Array[untyped]) -> void
|
|
718
|
+
def fill_gradient: (?type: untyped, ?degree: Numeric | nil, ?stops: Array[untyped]) -> void
|
|
719
|
+
|
|
720
|
+
# : (?all: Hash[Symbol, untyped]?, ?left: Hash[Symbol, untyped]?, ?right: Hash[Symbol, untyped]?, ?top: Hash[Symbol, untyped]?, ?bottom: Hash[Symbol, untyped]?, ?diagonal: Hash[Symbol, untyped]?) -> void
|
|
721
|
+
def border: (?all: Hash[Symbol, untyped]?, ?left: Hash[Symbol, untyped]?, ?right: Hash[Symbol, untyped]?, ?top: Hash[Symbol, untyped]?, ?bottom: Hash[Symbol, untyped]?, ?diagonal: Hash[Symbol, untyped]?) -> void
|
|
722
|
+
|
|
723
|
+
# : (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
724
|
+
def border=: (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
725
|
+
|
|
726
|
+
# : (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
727
|
+
def border_all: (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
728
|
+
|
|
729
|
+
# : (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
730
|
+
def border_left: (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
731
|
+
|
|
732
|
+
# : (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
733
|
+
def border_right: (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
734
|
+
|
|
735
|
+
# : (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
736
|
+
def border_top: (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
737
|
+
|
|
738
|
+
# : (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
739
|
+
def border_bottom: (?style: String | Symbol | Integer, ?color: String | Symbol | nil) -> void
|
|
740
|
+
|
|
741
|
+
# : (?style: String | Symbol | Integer, ?color: String | Symbol | nil, ?up: bool, ?down: bool) -> void
|
|
742
|
+
def border_diagonal: (?style: String | Symbol | Integer, ?color: String | Symbol | nil, ?up: bool, ?down: bool) -> void
|
|
743
|
+
|
|
744
|
+
# : (?horizontal: (String | Symbol)?, ?vertical: (String | Symbol)?, ?wrap_text: bool?, ?text_rotation: Integer?, ?indent: Integer?, ?shrink_to_fit: bool?, ?reading_order: Integer?, ?justify_last_line: bool?, ?relative_indent: Integer?) -> void
|
|
745
|
+
def alignment: (?horizontal: (String | Symbol)?, ?vertical: (String | Symbol)?, ?wrap_text: bool?, ?text_rotation: Integer?, ?indent: Integer?, ?shrink_to_fit: bool?, ?reading_order: Integer?, ?justify_last_line: bool?, ?relative_indent: Integer?) -> void
|
|
746
|
+
|
|
747
|
+
# : (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
748
|
+
def alignment=: (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
749
|
+
|
|
750
|
+
# : () -> (String | Symbol | nil)
|
|
751
|
+
def align_horizontal: () -> (String | Symbol | nil)
|
|
752
|
+
|
|
753
|
+
# : (String | Symbol value) -> (String | Symbol)
|
|
754
|
+
def align_horizontal=: (String | Symbol value) -> (String | Symbol)
|
|
755
|
+
|
|
756
|
+
# : () -> (String | Symbol | nil)
|
|
757
|
+
def align_vertical: () -> (String | Symbol | nil)
|
|
758
|
+
|
|
759
|
+
# : (String | Symbol value) -> (String | Symbol)
|
|
760
|
+
def align_vertical=: (String | Symbol value) -> (String | Symbol)
|
|
761
|
+
|
|
762
|
+
# : (bool value) -> bool
|
|
763
|
+
def wrap_text=: (bool value) -> bool
|
|
764
|
+
|
|
765
|
+
# : () -> bool
|
|
766
|
+
def wrap_text?: () -> bool
|
|
767
|
+
|
|
768
|
+
# : (bool value) -> bool
|
|
769
|
+
def shrink_to_fit=: (bool value) -> bool
|
|
770
|
+
|
|
771
|
+
# : () -> bool
|
|
772
|
+
def shrink_to_fit?: () -> bool
|
|
773
|
+
|
|
774
|
+
# : () -> (Numeric | nil)
|
|
775
|
+
def text_rotation: () -> (Numeric | nil)
|
|
776
|
+
|
|
777
|
+
# : (Numeric value) -> Numeric
|
|
778
|
+
def text_rotation=: (Numeric value) -> Numeric
|
|
779
|
+
|
|
780
|
+
# : () -> (Integer | nil)
|
|
781
|
+
def indent: () -> (Integer | nil)
|
|
782
|
+
|
|
783
|
+
# : (Numeric value) -> Numeric
|
|
784
|
+
def indent=: (Numeric value) -> Numeric
|
|
785
|
+
|
|
786
|
+
# : (?locked: bool?, ?hidden: bool?) -> void
|
|
787
|
+
def protection: (?locked: bool?, ?hidden: bool?) -> void
|
|
788
|
+
|
|
789
|
+
# : (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
790
|
+
def protection=: (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
|
|
791
|
+
|
|
792
|
+
# : (bool value) -> bool
|
|
793
|
+
def locked=: (bool value) -> bool
|
|
794
|
+
|
|
795
|
+
# : () -> bool
|
|
796
|
+
def locked?: () -> bool
|
|
797
|
+
|
|
798
|
+
# : (bool value) -> bool
|
|
799
|
+
def hidden=: (bool value) -> bool
|
|
800
|
+
|
|
801
|
+
# : () -> bool
|
|
802
|
+
def hidden?: () -> bool
|
|
803
|
+
|
|
804
|
+
# : () -> (String | Integer | nil)
|
|
805
|
+
def number_format: () -> (String | Integer | nil)
|
|
806
|
+
|
|
807
|
+
# : (String | Integer num_fmt_id) -> (String | Integer)
|
|
808
|
+
def number_format=: (String | Integer num_fmt_id) -> (String | Integer)
|
|
809
|
+
|
|
810
|
+
# : (untyped writer) -> Integer
|
|
811
|
+
def register_with: (untyped writer) -> Integer
|
|
812
|
+
|
|
813
|
+
# : (StyleBuilder other) -> bool
|
|
814
|
+
def same_format?: (StyleBuilder other) -> bool
|
|
815
|
+
|
|
816
|
+
# Lets StyleBuilder#same_format? compare with the definition without a warning.
|
|
817
|
+
# : () -> Array[untyped]
|
|
818
|
+
def format_signature: () -> Array[untyped]
|
|
819
|
+
|
|
820
|
+
private
|
|
821
|
+
|
|
822
|
+
# : () -> StyleBuilder
|
|
823
|
+
def definition_for_use: () -> StyleBuilder
|
|
824
|
+
end
|
|
825
|
+
|
|
826
|
+
# The order in which the styles of an {Xlsxrb.build} workbook are defined, shared by
|
|
827
|
+
# the workbook builder and its sheet builders. A row records the clock when it is
|
|
828
|
+
# added, so that it uses the definitions made before it, as a row written by
|
|
829
|
+
# {StreamWriter} does.
|
|
830
|
+
#
|
|
831
|
+
# @api private
|
|
832
|
+
class StyleLog
|
|
833
|
+
# Number of definitions so far.
|
|
834
|
+
# : Integer
|
|
835
|
+
attr_reader clock: untyped
|
|
836
|
+
|
|
837
|
+
# Each name's definitions, as [clock, builder] pairs in the order they were made.
|
|
838
|
+
# : Hash[String, Array[[Integer, StyleBuilder]]]
|
|
839
|
+
attr_reader definitions: untyped
|
|
840
|
+
|
|
841
|
+
# : () -> void
|
|
842
|
+
def initialize: () -> void
|
|
843
|
+
|
|
844
|
+
# : (String name, StyleBuilder builder) -> void
|
|
845
|
+
def record: (String name, StyleBuilder builder) -> void
|
|
846
|
+
end
|
|
586
847
|
end
|
|
@@ -45,6 +45,8 @@ module Xlsxrb
|
|
|
45
45
|
# @yield [style_builder]
|
|
46
46
|
# @yieldparam style_builder [Xlsxrb::StyleBuilder]
|
|
47
47
|
# @return [StyleBuilder]
|
|
48
|
+
# Using the returned value is deprecated and warns; in version 0.3.0, this method
|
|
49
|
+
# will return nil. Configure the style with options or in the block.
|
|
48
50
|
# @api public
|
|
49
51
|
# : (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
|
|
50
52
|
def style: (String | Symbol name, **untyped opts) ?{ (StyleBuilder) -> void } -> StyleBuilder
|
|
@@ -190,20 +192,30 @@ module Xlsxrb
|
|
|
190
192
|
# @param opts [Hash] Additional sheet properties.
|
|
191
193
|
# @yield [sheet_builder]
|
|
192
194
|
# @yieldparam sheet_builder [Xlsxrb::WorksheetBuilder]
|
|
193
|
-
# @return [
|
|
195
|
+
# @return [DeferredWorksheet] The sheet as {WorksheetBuilder#build} returns it, with
|
|
196
|
+
# style names in its cells. It is built when first used.
|
|
194
197
|
# @raise [ArgumentError] If sheet name violates Excel limits in strict mode.
|
|
195
198
|
# @api public
|
|
196
|
-
# : (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetBuilder) -> void } ->
|
|
197
|
-
def sheet: (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetBuilder) -> void } ->
|
|
199
|
+
# : (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetBuilder) -> void } -> DeferredWorksheet
|
|
200
|
+
def sheet: (?String? name, ?state: Symbol | String | nil, ?tab_color: String | Hash[Symbol, untyped] | Symbol | nil, ?code_name: String | Symbol | nil, **untyped opts) ?{ (WorksheetBuilder) -> void } -> DeferredWorksheet
|
|
198
201
|
|
|
199
|
-
#
|
|
202
|
+
# Adds a worksheet, as {#sheet} does.
|
|
203
|
+
#
|
|
204
|
+
# @deprecated Use {#sheet} to add a sheet. In version 0.3.0, this method will return the
|
|
205
|
+
# {WorksheetBuilder} of an existing sheet, or of the current sheet without an argument,
|
|
206
|
+
# and raise for a sheet that does not exist. Calling it with an argument, or without
|
|
207
|
+
# one after a sheet was added, warns.
|
|
200
208
|
#
|
|
201
209
|
# @param name_or_index [String, Symbol, Integer, nil]
|
|
202
210
|
# @yield [sheet_builder]
|
|
203
|
-
# @return [
|
|
211
|
+
# @return [DeferredWorksheet]
|
|
204
212
|
# @api public
|
|
205
|
-
# : (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetBuilder) -> void } ->
|
|
206
|
-
def []: (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetBuilder) -> void } ->
|
|
213
|
+
# : (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetBuilder) -> void } -> DeferredWorksheet
|
|
214
|
+
def []: (?String | Symbol | Integer | nil name_or_index) ?{ (WorksheetBuilder) -> void } -> DeferredWorksheet
|
|
215
|
+
|
|
216
|
+
INDEX_CREATES_SHEET_MESSAGE: ::String
|
|
217
|
+
|
|
218
|
+
INDEX_ADDS_SHEET_MESSAGE: ::String
|
|
207
219
|
|
|
208
220
|
# Adds a defined name (named range or formula) to the workbook.
|
|
209
221
|
# Bare cell references and coordinate keywords are automatically formatted with sheet quotes and absolute $ references.
|
|
@@ -397,8 +409,29 @@ module Xlsxrb
|
|
|
397
409
|
# : (untyped names, untyped sheets) -> untyped
|
|
398
410
|
def resolve_defined_names: (untyped names, untyped sheets) -> untyped
|
|
399
411
|
|
|
400
|
-
#
|
|
401
|
-
|
|
412
|
+
# Registers the styles of every sheet and builds the sheets' rows with their style
|
|
413
|
+
# names resolved to style indexes. Each cell is created once, here.
|
|
414
|
+
# : (Array[WorksheetBuilder::Snapshot] sheets) -> [Array[Elements::Worksheet], Hash[Symbol, untyped]]
|
|
415
|
+
def process_styles: (Array[WorksheetBuilder::Snapshot] sheets) -> [ Array[Elements::Worksheet], Hash[Symbol, untyped] ]
|
|
416
|
+
|
|
417
|
+
# Returns the key of the definition that the style +name+ stands for at style log
|
|
418
|
+
# +clock+: the last one made by then, or the first one if none was. A name defined
|
|
419
|
+
# once, or always with the same format, is its own key.
|
|
420
|
+
# : (String name, Integer? clock, Hash[String, Array[[Integer, String]]] versions) -> String
|
|
421
|
+
def style_version: (String name, Integer? clock, Hash[String, Array[[ Integer, String ]]] versions) -> String
|
|
422
|
+
|
|
423
|
+
# Marks the definition that the style +name+ stands for at style log +clock+ as used.
|
|
424
|
+
# : (untyped name, Integer? clock, Hash[String, Array[[Integer, String]]] versions, Hash[String, true] used_versions) -> void
|
|
425
|
+
def use_style_version: (untyped name, Integer? clock, Hash[String, Array[[ Integer, String ]]] versions, Hash[String, true] used_versions) -> void
|
|
426
|
+
|
|
427
|
+
# Records the date or time variant of the style named +style_key+ that a Date or
|
|
428
|
+
# Time +value+ in a row added at style log +clock+ needs, if any.
|
|
429
|
+
# : (untyped value, String style_key, Integer clock, Hash[String, Array[[Integer, String]]] versions, Hash[String, untyped] all_style_builders, Hash[String, StyleBuilder] version_builders, Hash[untyped, untyped] date_variants, Hash[String, untyped] variant_builders) -> void
|
|
430
|
+
def add_date_variant: (untyped value, String style_key, Integer clock, Hash[String, Array[[ Integer, String ]]] versions, Hash[String, untyped] all_style_builders, Hash[String, StyleBuilder] version_builders, Hash[untyped, untyped] date_variants, Hash[String, untyped] variant_builders) -> void
|
|
431
|
+
|
|
432
|
+
# Creates a cell whose style was resolved to +style+ (an index, or a name with no index).
|
|
433
|
+
# : (Integer row_index, Integer column_index, untyped value, untyped style, String? format_code, bool valid_coordinates) -> Elements::Cell
|
|
434
|
+
def resolved_cell: (Integer row_index, Integer column_index, untyped value, untyped style, String? format_code, bool valid_coordinates) -> Elements::Cell
|
|
402
435
|
|
|
403
436
|
# : (untyped writer) -> Hash[Symbol, untyped]
|
|
404
437
|
def extract_styles_from_writer: (untyped writer) -> Hash[Symbol, untyped]
|