View definition

def Axlsx::Package#serialize

Defined in github.com/randym/axlsx/lib/axlsx/package.rb

Description

Note:

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

Serialize your workbook to disk as an xlsx document.

Examples:

# This is how easy it is to create a valid xlsx file. Of course you might want to add a sheet or two, and maybe some data, styles and charts.
# Take a look at the README for an example of how to do it!

#serialize to a file
p = Axlsx::Package.new
# ......add cool stuff to your workbook......
p.serialize("example.xlsx")

# Serialize to a stream
s = p.to_stream()
File.open('example_streamed.xlsx', 'w') { |f| f.write(s.read) }

Parameters:

  • output (String)

    The name of the file you want to serialize your package to

  • confirm_valid (Boolean) (defaults to: false)

    Validate the package prior to serialization.

serialize is referenced in 0 repositories