I am using a valid licensed version of Apose.Cells(v4.5.1.0). I am merging cells for a "weeks" header, so it is an iterative loop that merges every 7 cells, and gives them a name (ie. A1-A7 is week 1, A8-A15 is week 2, etc.). Code is unavailable, but I am doing the merge exactly as described in this post.
Once the spreadsheet has been generated, I open it up and I receive the following error from Excel:
"Excel found unreadable content in 'excel.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."
The XML that is generated as the error report only says: "Removed Records: Merge cells from /xl/worksheets/sheet1.xml part.". Not very helpful.
After I click "Yes", the merged cells are all over the place on that row, seemingly completely inconsistent. Some got merged, some didn't, some have the text, some don't, the ones that were merged could be 30 or more cells! The important thing to note is that when I do NOT do Cells.Merge(), everything works exactly as it should--so it is definitely NOT a problem with my logic.
I tried 4.7 and still no change. After further analysis (and stepping through the code about 100 times), it would seem that the code is working correctly.
After I open the "repaired" file, the weeks are merged in the strangest fashion--it is exponential. For example, the first week is 7 days long, the second week is 14 days long, the third is 28 days long, the fourth 56 days, so on and so forth. The labels for the weeks are also exponential; ie the first week is week 1, week 2, week 4, week 16, week 32, etc. So the data between each of the weeks that are successfully merged is removed.
Unfortunately, sharing the .xlsx is impossible. Is there any way that I can see the spreadsheet before it is repaired--open it without Excel forcing me to repair it?
I just tried Merge() and UnMerge(). When I do that, the spreadsheet opens normally and all of the data is where it is supposed to be.
It would appear that the Merge() function itself corrupts the worksheet. Interesting.
Please note that, from what I can tell, it only causes issues when done in an iterative function. I also have the same problem in my functions that create months and years.
Found the issue. The IntelliSense for the CreateRange() method leads one to believe that you need to provide the FINAL CELL in the range, and not the LENGTH of the range. So, as i incremented the FINAL CELL integer by 7, it was merging by multiples of 7. It's still very odd that this corrupted the spreadsheet, and even more odd that when I did not do the Range.Merge() everything appeared to be found.
Anyway, once i put in the range length, all was well.
We are still not sure about your issue. We appreciate if you could post us your template sample file (with code if appropriate). If you have some confidential data which you don’t want to share with the Post , you can either create a sample file with some dummy data or send us your sample file via email. Please follow the following steps in this regard,
1: Please click the Contact button in the Post.
2: Select Send Amjad Sahi an email from the dropdown menu.
3: Enter the Relevant information in the Dialogue box, attach your sample file and send it.
Also, you may click the checkbox i.e.., "Keep this post private", so, only you and Aspose can see / download your attachments here.
We appreciate your help in this regard. We will figure out your issue soon.
Thank you.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.