I am using pre - defined template for generating excel files. Until now we were working with 4.7.0 version but we wish to upgrade to 4.8.0 version.
In my template I have two columns merged together Column A and B. After writing some data I want to merge every two rows of these columns. But this throws an exception. Cannot merge cells A1 A2 as cells are already merged.
This functionality was working with 4.7.0.
Thanks,
Deepali
Hi,
Could you post your template excel file with code to re-produce the issue, we will check it soon.
Thank you.
Hi Deepali,
Thank you for considering Aspose.
Well, I don’t think it is even possible in MS Excel that you can merge the columns and then merge some rows having the cells in the merged column range. I tried it in MS Excel and MS Excel first removes the already existing merging (merging of columns in your case) and then allows the new merging(merging of rows). You cannot have one cell in two different merges. In Aspose.Cells V4.7, this was an issue that it allowed already merged cell to be included in to a new merge, but we have fixed it in our latest version Aspose.Cells V4.8.0 and now you cannot merge a cell into multiple merges at the same time as Excel does not allows this.
Thank You & Best Regards,
@ nausherwan.aslam.
I have verified MS Excel allows merged cells to be merged once again. Please refer the attachment for details.
Thanks,
Deepali
Hi Deepali,
Sorry for the confusion. Actually MS Excel 2003 does not allow to merge a cell again which is already merged. We will look into the feasibility of further enhancing the merge function as per the MS Excel 2007 merge cell functionality and get back to you soon.
Thank You & Best Regards,
Hi Deepali,
If I look at your screenshot, I think Aspose.Cells for .NET v4.8.0.4 works in the same way.
I have tested it with the following code, I used a template file attached, the generated file is also attached.
Sample code:
Workbook book = new Workbook();
book.Open(“f:\test\BkToMerge.xlsx”);
Worksheet sheet = book.Worksheets[0];
sheet.Cells.Merge(0,0,2,2);
book.Save(“f:\test\ouput_BkToMerge.xlsx”,FileFormatType.Excel2007Xlsx);
If you have different results and found any issue, kindly post your template file with sample code, we will check it soon.
Thank you.
Thanks for the post. Sorry for the trouble. Found out issue in my code. Will need to update my code as well with the version
Thanks,
Deepali