xlsgen bug fixes

 

xlsgen 2.5 build #114 : Fix for worksheet names with special characters


Build 2.5.0.114 of xlsgen fixes a small issue when special characters are used in worksheet names.

Posted on 26-August-2008 13:18 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #113 : Improved printing/previewing/PDF of headers/footers (II)


Build 2.5.0.113 of xlsgen gets beyond the previous build and now repeats pictures and charts in areas of repeat rows and repeat columns.

Posted on 22-August-2008 13:58 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #112 : Improved printing/previewing/PDF of headers/footers


Build 2.5.0.112 of xlsgen improves how headers and footers are printed, previewed and exported as PDF.

Namely,
- better footer rendering
- better page numbering
- better streamlining of formatting tags

Posted on 20-August-2008 10:30 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #111 : Fix for rich strings in Excel 2007 files


Build 2.5.0.111 fixes a problem in xlsgen when reading Excel 2007 files, especially around richly formatted strings.

Posted on 19-August-2008 20:54 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #110 : Improved memory consumption for large template Excel 2007 files


Build 2.5.0.110 of xlsgen improves the memory consumption in scenarios where large Excel 2007 files are read. The memory consumption is 30% less, but more importantly, fragmentation is greatly reduced (memory fragmentation slows down the process).

This build is different from build 2.5.0.108 which improved the memory consumption for the generation of large Excel 2007 files (particularly files with many strings).

Posted on 12-August-2008 10:28 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #109 : Improved chart reverse engineering


Build 2.5.0.109 of xlsgen improves how charts are reverse engineered. Reverse engineering occurs when a chart is read in a template Excel file and then exposed in the charts collection. The improvement of reverse engineering in this area has consequences in a number of other features of xlsgen, including :
- improved object model exposure, particularly formatting details
- automatic source code generation of chart specs
- print/preview of pages with embedded charts
- migration of charts from Excel 97-2003 to Excel 2007 files

The improvements include the following :
- improved placement of the chart in the sheet
- 3D panel details (rotation, elevation, perspective, angle axis, height, auto scaling)
- hidden axis
- hidden data labels
- data labels formatting such as orientation, font and number format
- default font size of chart elements

Posted on 30-July-2008 22:47 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #108 : Improved memory consumption for large Excel 2007 files


Build 2.5.0.108 of xlsgen improves the way memory is consumed when processing large Excel 2007 files. Memory fragmentation could result in the inability to write files end-to-end.

Posted on 18-July-2008 14:02 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #107 : Fix for the trial version


A small fix in build 2.5.0.107 related to the trial version. In some cases the Trial version label and hyperlink would choke with the rest of Excel 2007 spreadsheets.

Posted on 14-July-2008 14:22 | Category: xlsgen, Excel generator

 

Importing an XML file


Even though xlsgen cannot directly import an XML file, it's easy to transform an XML file into a CSV file thanks to a XSL stylesheet, and then import the CSV file itself. Here is an example of how it works. Let's say we have :



  • An input XML file called books.xml, which as the name suggests is a collection of book titles
  • An XSL stylesheet called books_csv.xsl, which transforms the XML file into a CSV file
  • We are not interested in all fields of books.xml, rather we are interested in the ISBN, the title and the author's last name
  • The CSV file will use the comma (,) as a field separator. We need to make sure during the XML-to-CSV transform that whenever data includes a comma, it has to be enclosed in double-quotes so that it meets the rules of a regular CSV file (disambiguates the separator and actual content).


Here is books.xml :


<?xml version='1.0'?>
<!-- This file represents a fragment of a book store inventory database -->
<bookstore>
<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
<title>The Autobiography, of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
<title>The Gorgias</title>
<author>
<name>Plato</name>
</author>
<price>9.99</price>
</book>
</bookstore>


Here is the XSL stylesheet books_csv.xsl :


<!DOCTYPE stylesheet [
<!ENTITY newln "&#xD;&#xA;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" encoding="utf-8"/>

<xsl:template match="bookstore">
<xsl:apply-templates select="book"/>
</xsl:template>

<xsl:template match="book">
<xsl:if test="contains(@ISBN, ',')">&quot;</xsl:if>
<xsl:value-of select="@ISBN"/>
<xsl:if test="contains(@ISBN, ',')">&quot;</xsl:if>
<xsl:text>,</xsl:text>
<xsl:if test="contains(title, ',')">&quot;</xsl:if>
<xsl:value-of select="title"/>
<xsl:if test="contains(title, ',')">&quot;</xsl:if>
<xsl:text>,</xsl:text>
<xsl:apply-templates select="author"/>
<xsl:text>&newln;</xsl:text>
</xsl:template>

<xsl:template match="author">
<xsl:apply-templates select="last-name"/>
<xsl:apply-templates select="name"/>
</xsl:template>

<xsl:template match="last-name">
<xsl:if test="contains(., ',')">&quot;</xsl:if>
<xsl:value-of select="."/>
<xsl:if test="contains(., ',')">&quot;</xsl:if>
</xsl:template>

<xsl:template match="name">
<xsl:if test="contains(., ',')">&quot;</xsl:if>
<xsl:value-of select="."/>
<xsl:if test="contains(., ',')">&quot;</xsl:if>
</xsl:template>

</xsl:stylesheet>


Note :


  • This stylesheet is obviously designed to process books.xml. If the XML file used a different schema, a specifically designed stylesheet would be needed. There is no general purpose stylesheet to be used unfortunately, which means anyone willing to transform XML into CSV will have to get decent knowledge on Xpath expressions and XSLT transforms.
  • This stylesheet has many xls:if statements in it that are meant to try to catch whether the content uses commas, the field separator, in which case the content must be enclosed in double-quotes.
  • The stylesheet takes into account the fact that not every author's name has a last name, sometimes it's just a name.
  • We insert a newline after all fields of the current record are done.


XSLT processors are common on every single programming platform. In the following, we are going to use the XSLT processor that is part of the .NET run-time, but suffice to say there are many others (for instance, for C/C++ developers, there is libxslt).



The following .NET code simply processes the transform :



using System.IO;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;

XPathDocument input = new XPathDocument ("books.xml"); // input XML file

XslTransform trans = new XslTransform();
trans.Load("books_csv.xsl"); // XSL stylesheet

XmlTextWriter destination = new XmlTextWriter("result.csv", null); // output CSV file
trans.Transform(input, null, destination);
destination.Close();


And the resulting CSV file is :



1-861003-11-0,"The Autobiography, of Benjamin Franklin",Franklin
0-201-63361-2,The Confidence Man,Melville
1-861001-57-6,The Gorgias,Plato


With the CSV file in hands, it's now possible to import it in xlsgen directly. How it works is explained here.



Posted on 08-July-2008 10:23 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #106 : Fix for the auto-fit feature


Build 2.5.0.106 of xlsgen fixes a couple of edge cases in the auto-fit feature. The edge cases are as follows :
- handling of auto-fit on merged cells where the merge is orthogonal to the direction of the auto-fit
- handling of auto-fit on cells with carriage returns (\n) but without the Word wrap flag set

Posted on 07-July-2008 09:41 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #105 : Fix for the OpenFromMemory() scenario


Build 2.5.0.105 of xlsgen fixes a problem related to the OpenFromMemory() scenario, a scenario in which the input parameter is a memory buffer as opposed to a file. The problem was around the duplication and update of secondary streams such as VBA and document summary : it did not always work as intended.

Posted on 04-July-2008 10:14 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #104 : Fine-grained auto-fit


Build 2.5.0.104 of xlsgen improves the way auto-fit is processed.

Before that build, if you tried to auto-fit column A with a statement like this :

worksheet.Columns("A2:A5").AutoFit = True

xlsgen would compute the auto-fit on column A by computing the size of everything in that column, not just the content of rows 2 to 5.

Now those rows are taken care of, and can be used to limit the rows to process in that column.

It's still possible of course to apply auto-fit to the entire column, with a statement like this :

worksheet.Columns("A:A").AutoFit = True

Posted on 27-June-2008 19:57 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #103 : Fix for Excel 2007 document properties


Build 2.5.0.103 fixes how document properties are written in Excel 2007 files. Document properties are for instance : author, date, application version.

Posted on 16-June-2008 20:31 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #102 : Chart log scale base in Excel 2007 files


Build 2.5.0.102 of xlsgen makes it possible to set the logarithmic scale base of an axis of a chart. This applies to Excel 2007 files only, in which this option has been created. The default scale base is 10.

// use log base scale 2
chart->YAxis[xlsgen::chartaxis_primary]->Scale->LogarithmicScale = TRUE;
chart->YAxis[xlsgen::chartaxis_primary]->Scale->LogarithmicScaleBase = 2;

Posted on 28-May-2008 10:45 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #101 : Faster CSV import


Build 101 of xlsgen 2.5 improves the speed at which CSV files are loaded and processed. 20% faster on average.

Posted on 25-May-2008 21:03 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #100 : Improved round-tripping of Excel 2007 spreadsheets


In build 2.5.0.100, the way Excel 2007 files are read/updated is improved in that non-data details are better preserved. This reduces the risk of file corruption.

Posted on 14-May-2008 19:02 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #99 : Generating comments in Excel 2007 files


Build 2.5.0.99 makes it finally possible to generate comments (IXlsComment) in Excel 2007 files. The reason why this is only made available now is that the way comments are stored in Excel 2007 files is extremely awkward, so the incentive was pretty low.


Posted on 12-May-2008 11:08 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #98 : Deletion of VBA macros


Build 2.5.0.98 of xlsgen makes it possible to delete VBA macros in Excel spreadsheets. The DeleteMacros() method is exposed at the workbook level. The deletion of macros also involves the deletion of their bindings with spreadsheet objects (technically known as event handlers).

It works with Excel 97-2003 and Excel 2007 files.

Posted on 11-May-2008 13:18 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #97 : Alternative text and other picture options


Build 2.5.0.97 adds a couple more options when inserting pictures, namely :

- support for stretch option enumerator which allows to set how should the picture move and stretch according to column/row resizings. In Excel, this option can be found if you right-click on a picture, select "Format Picture..." and then select the "Properties" tab in the dialog. Default value is : move with cells, but no resize.
- support for the alternative text which allows to attach a string of text to a picture. In Excel, this option can be found if you right-click on a picture, select "Format Picture..." and then select the "Web" tab in the dialog.

Those properties are exposed in the IXlsPicture interface.

Of course, this works with both Excel 97-2003 and Excel 2007 spreadsheets.

Posted on 10-May-2008 13:00 | Category: xlsgen, Excel generator

 

xlsgen 2.5 build #96 : Duplicate pictures from external workbooks


Build 2.5.0.96 of xlsgen ensures that whenever a worksheet from an external workbook is duplicated (using DuplicateFrom()), pictures are duplicated as well.

In other words, cells, styles, formulas and now pictures get duplicated.

Posted on 09-May-2008 08:47 | Category: xlsgen, Excel generator

 

 

<-- previous page