Hi Laurence,
Thank you for the recent updates that have improved the robustness of Range.Copy(). It is quite a big improvement.
The current issue that I am facing now is with Cells[x,y].Style.Custom. I have an Excel template containing 5 worksheets. I explicitly assign custom formats to several cells in order to support multiple currency downloads on our Intranet.
When the Excel template is open, the first worksheet (ordering of the tabs from left to right), is intended to be a static, read only worksheet. I do not populate any data on the worksheet, nor do I set any custom styles.
On the next 3 of the remaining 4 worksheets, I set custom styles for various cells. When I perform the Excel download, the first worksheet, has one of my custom formats applied to it, even though I never reference that worksheet at all in my source code!
Other than that, the custom formatting appears to be working perfectly fine. The approach that I am using to select the cells and apply the styling is:
# region Excel worksheets private const string ET_REF_SHEET = “Ref”; private const string ET_SUMMARY_TABLES_SHEET = “Summary Tables”; private const string ET_DETAIL_TABLES_SHEET = “Detail Tables”; private const string ET_ADJUSTMENT_GRID_SHEET = “Adjustment Grid”; #endregion # region Overall Excel settings private const byte ET_MAX_SALES_OVERVIEW = 20; private const byte ET_MAX_SALES_SUMMARY = 6; #endregion # region Ref sheet specific row and column locations private const int ET_REF_START_ROW = 1; private const byte ET_REF_SALE_NUMBER = 0; private const byte ET_REF_PROPERTY_NAME = 1; … #endregion // // Prepares the download and returns an Excel to the caller // protected override Excel RunDownload() { // Populate the Ref sheet Worksheet sheet; Cells cells; Cells sumTablesCells; Cells detailTablesCells; Cells adjustmentGridCells; sheet = excel.Worksheets[ET_REF_SHEET]; cells = sheet.Cells; sumTablesCells = excel.Worksheets[ET_SUMMARY_TABLES_SHEET].Cells; detailTablesCells = excel.Worksheets[ET_DETAIL_TABLES_SHEET].Cells; adjustmentGridCells = excel.Worksheets[ET_ADJUSTMENT_GRID_SHEET].Cells; … sumTablesCells[ET_ST_DETAIL_TABLES_START_ROW, ET_ST_DETAIL_TABLES_PRICE_STYLE_COL].Style.Custom = numberStyleStr; … etc. etc. |
Please let me know if this is a known issue, or how you would like to proceed to investigate further.
Thanks
Shan Plourde