xlsgen bug fixes

Generate Excel files. Speed. Flexibility. Depth. Robustness.

 

Subscribe our RSS feed

xlsgen 4.5.0.93 : Fix in PDF text rendering


Build 4.5.0.93 of xlsgen fixes a problem related to rendering large pieces of strings in PDF, in the native PDF rendering. The clip region could become too small if the print scale was causing great shrink (fit to x page scenarios).

Posted on 01-April-2020 15:01 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.92 : Support for the LET function


Build 4.5.0.92 of xlsgen adds read, write and calc support for the new LET() function.

Microsoft announced earlier in march that they would add the LET() function to the arsenal of Excel functions. Announcement is here.

The point of the LET() function is to able to name expressions that are often used multiple times in the formula and use the name instead of the expressions, improving the readability of the formula not just for the person who wrote the formula, but also for everyone else who will be tasked to update the Excel spreadsheet.

Microsoft made clear that this LET() function will only be made available on a subscription basis to Office 365 and none of the existing Excel versions out there will obtain it (we are talking about Excel 2019, 2016, 2013, ... none of which will ever get it).

xlsgen ships with support for the LET() function so you can write and calculate those formulas.

Here is an example :

LET( name1, expression1,
name2, expression2,
...
expression)

this function calculates expression where a number of smaller expressions appear, namely expression1, expression2, ... Instead of using the expression, this function lets the formula writer use name1, name2, ...

The ability to use names instead of literal expressions may improve the readability of the formula. And in addition to this, if a smaller expression is used multiple times in the global expression, using names instead improves the readability as well. And it improves the performance of calculations by caching (internally) smaller expression evaluations.


Posted on 27-March-2020 23:48 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.91 : Formula update control


Build 4.5.0.91 of xlsgen adds the option related to updating formula specs whenever there is a row or column insertion or deletion.

By default, formulas in the workbook are updated to reflect the new rows or columns, and doing this keeps the integrity of the spreadsheet. But sometimes, depending on your scenario, it may be needed to keep the formula specs intact. That's what you can obtain by setting False to a new property we are making available at the workbook level, i.e.

workbook.FormulaDefinitionUpdate = False

Posted on 18-March-2020 18:51 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.90 : Chroma key color in pictures


Build 4.5.0.90 of xlsgen adds a new property to pictures, the ability to set a RGB-based chroma key in order to make transparent all pixels in that picture with that RGB color. This works with all Excel files.

Here is how it works. Assuming you have a picture to be inserted, where you know in advance that the red color is used as chroma key :

(C++ code follows)

xlsgen::IXlsPicturePtr picture1 = worksheet->Pictures->Add( L"input\\a.gif" );
picture1->LeftColumn = 1;
picture1->TopCell = 1;
picture1->ChromaKeyColor = 0xFF0000; // RED chroma key



Setting the chroma key color lets one see through the picture
Posted on 26-February-2020 19:22 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.89 : Fix for the TEXT() function


Build 4.5.0.89 of xlsgen fixes a problem related to the calculation of a special operand used in the TEXT() function. It's the case where the operand uses a percent-formatted number.

Posted on 20-February-2020 18:57 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.88 : Improved linking over external duplicate


Build 4.5.0.88 of xlsgen improves how linking behaves in duplicate scenarios involving external workbooks.

Before this build, any link from an external workbook, for instance a chart series formula, would be expanded to literals and copied over to the destination sheet. Beginning with this build, links are brought as is, as long as the links depend only on the sheet being duplicated. When the link depends on a sheet not being copied over, the link is expanded as literals and brought over as literals.

This build also exposes the text boxes collection inside charts. So far only pictures and vector shapes were exposed (for querying purposes).

Posted on 18-February-2020 20:23 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.87 : Fix pack for duplicates


Build 4.5.0.87 of xlsgen adds support for copying hyperlinks (url, file, sheet location) stored in text boxes, vector shapes and pictures in duplicate scenarios.

Posted on 12-February-2020 16:20 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.86 : Fix pack for charts


Build 4.5.0.86 of xlsgen is a fix pack for charts :

- when duplicating charts, improved accuracy of chart formatting details such as chart XY type combination, axis type, font details

- also when duplicating charts, make sure to copy text boxes, vector shapes, pictures and charts (both inside charts)

- when reading existing charts, better read font details and better read of leader lines in the case of a bar/column chart



Posted on 09-February-2020 18:59 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.85 : Fix for inserting a row


Build 4.5.0.85 of xlsgen fixes a problem related to moving auto-filters accordingly, if present, when inserting a row or a column. This works for all Excel files and avoids corrupting the file in question.

Posted on 03-January-2020 07:20 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.84 : Security fix for libPNG


Build 4.5.0.84 of xlsgen ships with the latest stable version of libPNG, a third party library that allows to read and write pictures in the PNG file format, which includes a number of security fixes. We are using libpng 1.6.37. libPNG is the only third party dependency of xlsgen and is used at a number of end points, for instance for PNG picture rendering purposes.

Posted on 26-December-2019 12:35 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.83 : Improved tables (II)


Build 4.5.0.83 of xlsgen adds support for database connections in table objects.

Before this build, you could program and run SQL requests but the result would not become an actual Excel table object fetched with the database data. It would just be rows fetched with database data. Likewise if you created an actual Excel table object in xlsgen, you couldn't program and run an SQL request from it.

This is put together in this build. You can now create an actual Excel table object, program and run an SQL request that will bound the table rows to the underlying database. And even better, xlsgen creates the database connection in the Excel file so you can reuse it elsewhere.

Here is how it works,


xlsgen::IXlsWorkbookPtr workbook;
workbook = engine->New( L"output.xlsx" );

xlsgen::IXlsWorksheetPtr worksheet = workbook->AddWorksheet("SheetX");

xlsgen::IXlsTablePtr table = worksheet->NewTable[3][2];

table->DataSource->CommandTimeout = 40;
table->DataSource->ConnectionTimeout = 120;
#ifndef _WIN64
table->DataSource->ConnectionString = L"Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\\datasource\\db1.mdb;uid=;pwd=;";
#else
table->DataSource->ConnectionString = L"Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=c:\\datasource\\db1.mdb;uid=;pwd=;";
#endif

table->DataSource->SQLStatement = L"select * from Table1";

int nbrows = table->DataResults->RowCount;
int nbcolumns = table->DataResults->Columns->Count;

_bstr_t column1 = table->DataResults->Columns->Item[1]->Name;
_bstr_t column2 = table->DataResults->Columns->Item[2]->Name;
_bstr_t column3 = table->DataResults->Columns->Item[3]->Name;
_bstr_t column4 = table->DataResults->Columns->Item[4]->Name;
_bstr_t column5 = table->DataResults->Columns->Item[5]->Name;

_bstr_t definedName = table->DataResults->Name;

xlsgen::IXlsStylePtr styleDate = worksheet->NewStyle();
styleDate->Format = L"dd/mm/yyyy";

xlsgen::IXlsStylePtr styleBackground = worksheet->NewStyle();
styleBackground->Pattern->BackgroundColor = 0xFF0000;

table->DataResults->Columns->Item[4]->DataStyle = styleBackground;

table->DataResults->Insert();

workbook->Close();



Posted on 23-December-2019 10:19 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.82 : Improved tables


Build 4.5.0.82 improves the handling of tables, particularly Excel table objects.

In xlsgen, tables can be used in a variety of ways. They were initially introduced as a way to program and run SQL requests. Then, when business intelligence capabilities were introduced to xlsgen, tables were the underlying model for manipulating data (i.e. InferFromWorksheet()). Actual Excel tables were available, see tables for more information, but were not quite first-class citizen. For instance, what you couldn't do is for example add totals to them even though the table object model in xlsgen exposes subtotals beneath table breaks. The reality was that many of the table features were for "xlsgen" tables, not Excel table objects.

In this build, total rows are not ignored anymore for Excel table objects. It works like this :


xlsgen::IXlsTablePtr table = worksheet->Tables->Add();

table->DataSource->Range = L"R3C2:R6C6";

table->DataResults->Style->BuiltinStyle = xlsgen::tablestyle_light03;

// we have an "age" column in the table

xlsgen::IXlsTableBreaksPtr br = wksht->Tables->Item[1]->DataResults->Columns->ItemByName[L"age"]->Breaks;

// compute the average of "age"

br->Subtotals->Add( wksht->Tables->Item[1]->DataResults->Columns->ItemByName[L"age"] )->BuiltinFunction = xlsgen::subtotalfunc_average;




Also, table objects are now exposed in the automatic source code generator. It exposes table range definition, style and totals.

Posted on 23-December-2019 10:11 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.81 : Fix for rendering rotating text


Build 4.5.0.81 of xlsgen improves how rotated text is handled in rendering scenarios. Particularly this is an edge case that is fixed, where the rotate angle is very high (more than 45 degrees) and the room for rotating the text is small (cell has tight width and height).

It is a time to remind client and server applications using PDF output (one of our rendering outputs), that the quality of the rendering is slightly affected by the actual engine that is used. Notably,


  • native PDF generation (vectors) [default engine]

    C/C++ code
    // worksheet level
    workbook->PDFEngine = xlsgen::pdfengine_text;
    worksheet->Export->ExportAsPDF(L"output.pdf");

    // workbook level
    workbook = engine->Open(L"input.xlsm", L"outputAllWorksheets.pdf");
    workbook->PDFEngine = xlsgen::pdfengine_text;
    workbook->Close();


  • GDI-based PDF generation (screen DPI resolution, usually 96 DPI)


    C/C++ code
    // worksheet level
    workbook->PDFEngine = xlsgen::pdfengine_bitmap;
    worksheet->Export->ExportAsPDF(L"output.pdf");

    // workbook level
    workbook = engine->Open(L"input.xlsm", L"outputAllWorksheets.pdf");
    workbook->PDFEngine = xlsgen::pdfengine_bitmap;
    workbook->Close();


  • GDI-based virtual PDF printing (printer DPI resolution, usually 600 DPI)


    C/C++ code
    // worksheet level
    worksheet->PrintWith(L"PDFCreator", L""); // PDFCreator is a popular (and free) virtual PDF printer

    // workbook level
    workbook = engine->Open(L"input.xlsm", L"");
    workbook->PrintWith(L"PDFCreator", L"");
    workbook->Close();
Posted on 12-December-2019 08:43 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.80 : Try parse formula


Build 4.5.0.80 of xlsgen adds support for testing the parsing of formulas. Typically, writing a formula in a cell or to an object returns an exception if there is a problem, but it does not tell what the problem is. This parsing error is specifically the purpose of the introduced TryParseFormula method available at the workbook level.


typedef enum
{
[helpstring("Formula parsing error, no error")] parseformula_noerror = 0,
[helpstring("Formula parsing error, syntax error")] parseformula_syntaxerror = 1,
[helpstring("Formula parsing error, out of memory")] parseformula_outofmemory = 2,
[helpstring("Formula parsing error, not enough parameters")] parseformula_notenoughparams = 3,
[helpstring("Formula parsing error, too many parameters")] parseformula_toomanyparams = 4,
[helpstring("Formula parsing error, impaired parenthesis")] parseformula_impairedparenthesis = 5,
[helpstring("Formula parsing error, impaired brace")] parseformula_impairedbrace = 6,
[helpstring("Formula parsing error, division by zero")] parseformula_divisionbyzero = 7,
[helpstring("Formula parsing error, function does not exist")] parseformula_functionnotexist = 8,
[helpstring("Formula parsing error, wrong argument separator")] parseformula_wrongargumentseparator = 9

} enumParseFormulaError;


It works like this :

C/C++ code

xlsgen::enumParseFormulaError error = workbook->TryParseFormula(L"=SUMXYZ(5;3;A2)"); // returns parseformula_functionnotexist because SUMXYZ() does not exist



Posted on 05-December-2019 23:19 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.79 : Fix pack


Build 4.5.0.79 of xlsgen is a fix pack. It has the following :

- pivot tables now use localized strings. For instance, "Grand Total" is no longer hardcoded. It follows the current formula language (which you can set from the corresponding property in the workbook object, and which is one of EN/FR/DE/IT/PO/ES).

- fixed an edge case in rendering cells when the content has multiple lines separated by carriage returns, but no room vertically to show everything and the wrap flag set to off. Excel in this case ignores carriage returns. This is what xlsgen does now.

Posted on 03-December-2019 14:41 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.78 : UI-related pivot table settings (II)


Build 4.5.0.78 xlsgen follows previous build (4.5.0.77) related to pivot table UI settings in Excel.

This build writes back the UI settings listed below, including existing pivot tables, i.e. pivot tables that were not created using xlsgen.

Also the automatic source code generator now generates the corresponding source code for those.

Pivot table UI settings (in Excel) :
- EnablePivotTableUI (yes/no) : when set to no, the entire user interface for manipulating pivot tables is hidden
- ShowDetails (yes/no) : when set to no, non-aggregate values do not appear
- EnableFieldListUI (yes/no) : when set to no, the field list view is hidden
- EnableFieldPropertiesUI (yes/no) : when set to no, field properties dialog does not appear (looks like a bug for the end user because Excel does not gray out the menu)
- ShowFieldHeaders (yes/no) : when set to no, hides field elements

And also, in pivot table data source options,
- RefreshEnabled (yes/no)

Posted on 02-December-2019 12:06 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.77 : UI-related pivot table settings


Build 4.5.0.77 of xlsgen adds a number of user interface properties to the object model, for pivot tables. Those properties affect the experience of viewing or working with pivot tables in Excel.

They are :

in pivot table options
- EnablePivotTableUI (yes/no) : when set to no, the entire user interface for manipulating pivot tables is hidden
- ShowDetails (yes/no) : when set to no, non-aggregate values do not appear
- EnableFieldListUI (yes/no) : when set to no, the field list view is hidden
- EnableFieldPropertiesUI (yes/no) : when set to no, field properties dialog does not appear (looks like a bug for the end user because Excel does not gray out the menu)
- ShowFieldHeaders (yes/no) : when set to no, hides field elements

And also, in pivot table data source options,
- RefreshEnabled (yes/no) : when set to no, makes it impossible for the user to refresh the data source associated to the pivot table

Posted on 28-November-2019 16:11 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.76 : Edit table ranges (II)


Build 4.5.0.76 of xlsgen follows previous build 4.5.0.75 and adds another table property, DataRange, in order to differentiate :

- data rows : DataRange property
- header + data + totals : Range property

Both are read and write properties.

Posted on 28-November-2019 16:04 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.75 : Edit table ranges


Build 4.5.0.75 of xlsgen allows to edit ranges of existing tables. This applies to XLSX (and their variants) and XLSB files.


To obtain the cell range,

C++ code


_bstr_t range = worksheet->Tables->ItemByName[L"Table1"]->DataSource->Range; // returns a cell range of the form RxCx:RyCy




To change it,

C++ code


worksheet->Tables->ItemByName[L"Table1"]->DataSource->Range = L"R1C1:R15C10";




Alternatively, if the scenario knows in advance that all it needs is to add a new row to the table,

C++ code


worksheet->Tables->ItemByName[L"Table1"]->DataSource->AddRow();



Posted on 28-November-2019 09:10 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

xlsgen 4.5.0.74 : Support for XMATCH/XLOOKUP functions



Build 4.5.0.74 of xlsgen adds read, write and calculation support for XMATCH() and XLOOKUP() functions.

Those functions have been recently introduced by Microsoft as part of Office 365 insider preview and they'll be made available with an Office 365 subscription in 2020. They will never be supported in any existing Excel version (2007/2010/2013/2016/2019).

xlsgen supports them right now.

XMATCH() and XLOOKUP() are, according to Microsoft, more powerful versions of MATCH() and LOOKUP() functions.

They are indeed more powerful in the sense that MATCH() has several lookup algorithms, it does not go only top to bottom. And XLOOKUP() is more powerful than traditional LOOKUP()/HLOOKUP()/VLOOKUP() functions in the sense that the same function supports looking up in all directions, also it has a "if not found" fallback parameter which can be set optionally, and finally the return range is arbitrarily set. In other words, XMATCH() and XLOOKUP() can replace complex combinations of simpler functions sometimes.

Syntax : (optional arguments are square braced)

XMATCH(lookup_value, lookup_array, [match_mode], [search_mode])

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])


match_mode is {0 = exact, 1 = lesser approximation, -1 = higher approximation, 2 = exact with wildcard characters}

search_mode is {1 = top-to-bottom search, -1 = bottom-to-top, 2 = half split top to bottom, -2 = half split bottom to top}

Posted on 17-November-2019 13:00 | Category: xlsgen, Excel generator | Tags: generating Excel spreadsheets

 

 

<-- previous page