MyXls
Examples:
Simplest
(
C# or
VB code-behind)
- The very simplest MyXLS scenario. Creates and sends a Workbook
with 1 Worksheet and no data. The File/Workbook name defaults to "Book1.xls"
and when no worksheets are explicitly added, by default you get one named "Sheet1".
Sound familiar?
This demonstrates the barebones code necessary to place this on a page. It
shows the using statement to make things easier, the instantiation of the XlsDocument
object, and calling the Send method on that XlsDocument object. The Send method
handles checking the HttpResponse for buffering, clearing the buffer, writing the
file, and flushing the buffer. You won't see anything on the web page, just
get a popup prompt to download your file.
Hello, World!
(
C# or
VB code-behind) - An approximation of a classic programming example. One Workbook
"MyXLS_Hello_World.xls" with one Worksheet "Hello, World!" and cell A1 says "Hello,
World!". This just adds three lines to the Simplest scenario: naming the file
the Excel file generated and sent to the user, adding a Sheet with a specific name,
and writing a value to a cell.
Wacky
(
C# or
VB code-behind) - The key components of this are the lines that get the new XF object
and initialize it to the desired formatting. It's not immediately obvious,
but IntelliSense should help you figure out what how to do what you want.
This is pretty ridiculous, really, but demonstrates that MyXLS can indeed do genuine
formatting beyond what you could accomplish with .csv files, pre-2007 Excel XML
or HTML, or other free methods that don't generate an actual binary Excel file.
This sample demonstrates how to add metadata visible in the Excel File -> Properties
menu.
Certainly you all will suggest many improvements and request additional documentation.
We're only two guys so far, though, so maybe you could help out? Otherwise,
we'll get to it when we can, but meanwhile are focused on filling out the featureset
of MyXLS.