Hi,
We have just upgraded from Aspose v7.2.0.3 to v8.5.0.0 and noticed a change in the ImportDataTable behaviour that is causing problems for us.
In the previous version, the formatting and data validation settings would be copied for each new row inserted, when insertRows = true.
However, with 8.5.0.0, the copying of formatting does not occur. I realize that this better mimics the behaviour of Excel, and this is something that Aspose strives for. However, for us, this is a breaking change, and we have hundreds of exisitng Excel-templates that rely on it.
It is actually a very convenient way to import data into a sheet, and use the first row as a formatting template. The only problem has been that there is an extra row, one row below the imported data, that had to be deleted by code.
Can you recommend how to achieve the same result with the new Aspose version? What would be great would be a flag to ImportDataTable which would control if the existing formatting/data validation should be used for all inserted rows. This would ideally not leave an extra row with formatting below the imported range (please see attached result files to see what I mean by that extra row)
See the code and Excel files attached.
Description of files:
ImportDataTable.cs - the code
ImportDataTable.xlsx - the designer template
ImportDataTable_result_7.2.0.3.xlsx - result with Aspose 7.2.0.3
ImportDataTable_result_8.5.0.0.xlsx - result with Aspose 8.5.0.0
Hi,
Thanks for your posting and using Aspose.Cells.
We were able to observe this issue and logged this issue in our database for improvement. We will look into it and see if we could introduce one additional parameter to fulfill your requirements and if it is feasible to do so. Once, there is some fix or other update for you, we will let you know asap.
This issue has been logged as
- CELLSNET-43860 - Use existing row’s formatting while importing data table
Hi,
Thanks for using Aspose.Cells.
This is to inform you that we have fixed your issue CELLSNET-43860 now. We will soon provide the fix after performing QA and including other enhancements and fixes.
That is excellent news!
One more thing:
I think I discovered a bug in Aspose 8.5.0.0, related to this.
In my example attached in this thread, the data as imported in the first row, first column:
sourceCells.ImportDataTable(tbl, true, 0, 0, tbl.Rows.Count, tbl.Columns.Count, true);
In that case, no formatting was copied.
However, if I change to second row, second column:
sourceCells.ImportDataTable(tbl, true, 1, 1, tbl.Rows.Count, tbl.Columns.Count, true);
and change the Excel template accordingly, then the color formatting will be copied, but not the data validation.
/Fredrik
Hi,
Hi,
Yes, the behaviour is now back to the previous version’s (v7.2.0.3): both color formatting and data validation is copied when insertRows = true.
Although I am delighted that you could address this so promptly, I am a little concerned about the change in the default behaviour (again) of ImportDataTable.
There could be a chance that some of your other customers will find this a breaking change? And then you might fix it back to the v8.5.0.0 behaviour, thus breaking it for us again…
What do you think? Maybe it would be better to stay with the current v8.5.0.0 behaviour (no formatting gets copied) and then introduce an optional flag to ImportDataTable? Maybe that flag could mimic the options you get when inserting a new row in Excel:
Format as above, Format as below (we would use this option), Clear formatting (default behaviour).
Of course, there is also that bug in v8.5.0.0 I mentioned (color formatting gets copied when the row>0)…
Thanks,
Fredrik
fredrikg:Yes, the behaviour is now back to the previous version's (v7.2.0.3): both color formatting and data validation is copied when insertRows = true.Although I am delighted that you could address this so promptly, I am a little concerned about the change in the default behaviour (again) of ImportDataTable.
There could be a chance that some of your other customers will find this a breaking change? And then you might fix it back to the v8.5.0.0 behaviour, thus breaking it for us again…
What do you think? Maybe it would be better to stay with the current v8.5.0.0 behaviour (no formatting gets copied) and then introduce an optional flag to ImportDataTable? Maybe that flag could mimic the options you get when inserting a new row in Excel:
Format as above, Format as below (we would use this option), Clear formatting (default behaviour).
fredrikg:Of course, there is also that bug in v8.5.0.0 I mentioned (color formatting gets copied when the row>0
Hmm, when I try to manually perform the “ImportDataTable” in Excel I do the following:
- Select the row where the data is to be inserted
- Right-click the row and select “Insert”
- Repeat for #2 for each row in the data table
- Paste the data into the new area
In this case, formatting does not get copied. What are the manual steps you use?
About the bug, I mention it in earlier in this conversation, but it is fixed in v8.5.2.2:
"In my example attached in this thread, the data as imported in the first row, first column:
sourceCells.ImportDataTable(tbl, true, 0, 0, tbl.Rows.Count, tbl.Columns.Count, true);
In that case, no formatting was copied. However, if I change to second row, second column:
sourceCells.ImportDataTable(tbl, true, 1, 1, tbl.Rows.Count, tbl.Columns.Count, true);
and change the Excel template accordingly, then the color formatting will be copied, but not the data validation"
Hi,
As I see it then, is that the behaviour in v8.5.2.2 does not mimic the default functionality in Excel.
It is rather the behaviour you get if you change the formatting option to “Format Same as Below”.
But I am not going to argue against this anymore. It works fine for us, as long as Aspose doesn’t change it back in the future
Thanks!
/Fredrik
Hi Fredrik,