Build 2.5.0.93 of xlsgen adds the auto-size option for floating text boxes (in the worksheets, or in charts). This option makes it possible to ensure that the boundaries of the text box are computed to fit the text inside it.
Note that this option is ignored when it targets Excel 2007 files. The reason why is that there is not such option in the Excel 2007 file format. What Excel 2007 does is compute the size to fit the text inside it.
Here is a sample code in C/C++ :
xlsgen::IXlsChartPtr chart1 = wksht->NewChart(xlsgen::charttype_bar2D,
8, //row1
1, //col1
20, //row2
7 //col2
);
xlsgen::IXlsChartDataSourcePtr datasource1 = chart1->DataSource;
datasource1->SeriesInRows = TRUE;
datasource1->Range = L"Sheet2!R1C2:R4C8";
xlsgen::IXlsChartTextBoxPtr tb1 = chart1->AddTextBox();
tb1->Options->X = 10;
tb1->Options->Y = 20;
tb1->Options->Width = 10; // ignored
tb1->Options->Height = 10; // ignored
tb1->Label = L"label1 Label2";
tb1->AutoSize = TRUE;