[ic] backup_database coretag -- some suggested improvements
Carl Bailey
carl at triangleresearch.com
Fri May 12 16:09:35 EDT 2006
We ran into a problem recently doing a multi-table export to an xls
file from the UI in IC 5.4. Basically the export looked like it was
working, but the result was a zero-byte xls file. Well, after much
toil and strife, we found out that there is a file-size limit of
7087104 bytes imposed in the Workbook.pm (part of
Spreadsheet::WriteExcel). It's not clear what's behind that
odd-sounding number, but right there in the module it says, if you need
bigger spreadsheets, use Spreadsheet::WriteExcel::Big. That seems to
be a better default module for Interchange to use.
We made some changes to ~interch/code/UI_Tag/backup_database.coretag
- require Spreadsheet::WriteExcel;
- import Spreadsheet::WriteExcel;
+ require Spreadsheet::WriteExcel::Big;
+ import Spreadsheet::WriteExcel::Big;
- $xls =
Spreadsheet::WriteExcel->new("$backup_dir/DBDOWNLOAD.xls");
+ $xls =
Spreadsheet::WriteExcel::Big->new("$backup_dir/DBDOWNLOAD.xls");
... and this worked very well indeed, since the "Big" module was
already installed on our server. No more zero-byte results.
However, we also noticed that the coretag creates XLS files that are
much larger than necessary for sparsely populated tables (where many of
the columns are blank, as was true in our case). So the following
change (also to backup_database.coretag) made the resulting XLS file
substantially smaller:
- $sheet->write_string($i, $j, $fields[$j]);
+ $sheet->write_string($i, $j, $fields[$j]) if
length($fields[$j]);
This same patch should also work for IC 5.2. We have not checked
earlier versions.
More information about the interchange-users
mailing list