Fixes
Workbook_Open — file branch left junk files and locked them.File.Open(path, FileMode.OpenOrCreate) silently created a 0-byte file on a typo'd path (then EPPlus failed with a cryptic "central directory not found"), and the FileStream was never disposed, so the file stayed locked by the app-pool process until GC.Now uses FileMode.Open / FileAccess.Read / FileShare.Read and disposes the stream via using.
Workbook_Open
File.Open(path, FileMode.OpenOrCreate)
FileStream
FileMode.Open
FileAccess.Read
FileShare.Read
using
ConditionalFormatting_DeleteRule deleted the wrong rule.The guard requires index >= 1, but ExcelConditionalFormattingCollection.RemoveAt(...) is a standard 0-based collection. So the first rule could never be deleted (it would remove rule 2), and every other index was off by one.
ConditionalFormatting_DeleteRule
index >= 1
ExcelConditionalFormattingCollection.RemoveAt(...)
Cell_WriteImageByIndex / Cell_WriteImageByName placed the image one cell down-right.EPPlus's ExcelPicture.SetPosition(row, …, col, …) takes a 0-based anchor. The wrapper passed the OutSystems 1-based row/column raw, so writing to A4 actually landed at B5. Image_Insert already converted correctly (range.Start.Row - 1); this brings the two image actions in line.
Cell_WriteImageByIndex
Cell_WriteImageByName
ExcelPicture.SetPosition(row, …, col, …)
A4
B5
Image_Insert
range.Start.Row - 1
Minor cleanup: stray double semicolon in Column_Hide_Show and a dead STDataSeriesStructure curr_series local in Chart_Create.
Column_Hide_Show
STDataSeriesStructure curr_series
Chart_Create
MssCell_WriteImageByIndex – leaked image handles. The Image and MemoryStream were never disposed (a leak on every call). They are now wrapped in using blocks.
MssCell_WriteImageByIndex
Image
MemoryStream
MssWorksheet_GetImages – images were always re-encoded as GIF. Util.ImageToByteArray saved every image as GIF regardless of the original format (lossy, wrong type). It now preserves the original format, falling back to PNG for formats that cannot be written directly.
MssWorksheet_GetImages
Util.ImageToByteArray
Added the Chart_Create action which allows for creation of charts in a specific worksheet.
Define the ranges of cells from which you want to feed your series into the chart and choose from a number of types by passing in the name of the type.
Check out an example here:
https://www.outsystems.com/forums/discussion/36870/advanced-excel-chart-creation-example/
A new action has been added to the "Advanced Excel" extension called “Workbook_AddOsDbSheet”.
This action will need a few input parameters, like the WorkbookInObj, the WorksheetName, the OsDbDataSet, the RowStart, the ColumStart and IncludingHeader.
When this action is used for the first time in a row, the WorkbookInObj should be nullObject().
In that case the action will automatically open a workbook object, which reference will be returned via WorkbookOutObj afterwards.
The next time the action is used the WorkbookInObj will be populated with the previous WorkbookOutObj reference. The use of the other fields is clear, I guess.
Upgrade to version 9