blob: 611da1aa251243117a885a373be1c933cd7e4671 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
module Axlsx
# This class manages the serialization of rows for worksheets
class SheetData
# Creates a new SheetData object
# @param [Worksheet] worksheet The worksheet that owns this sheet data.
def initialize(worksheet)
raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
@worksheet = worksheet
end
attr_reader :worksheet
# Serialize the sheet data
# @param [String] str the string this objects serializaton will be concacted to.
# @return [String]
def to_xml_string(str = +'')
str << '<sheetData>'
worksheet.rows.each_with_index do |row, index|
row.to_xml_string(index, str)
end
str << '</sheetData>'
end
end
end
|