Hi,
Please can you help with an issue I am having regarding combining workbooks.
I have specified table names in the workbooks that I want to combine.
When I perform a Workbook1.Combine(Workbook2) command, the resulting merged document has reset the table names for the second workbook. Although the first workbook’s table names are intact.
is there a bug with this function, or is there a way to avoid the table names resetting?
Here is my code:
public static void TestMergeFiles(byte[] bArray1, byte[] bArray2)
{
//Instantiate the License class
Aspose.Cells.License licenseCells = new Aspose.Cells.License();
//Pass only the name of the license file embedded in the assembly
licenseCells.SetLicense(“Aspose.Total.lic”);
string filePath = Path.GetTempFileName() + “.xlsx”;
if ((bArray1 != null) && (bArray2 != null))
{
Workbook masterWorkbook = new Workbook(new MemoryStream(bArray1));
Workbook secondWorkbook = new Workbook(new MemoryStream(bArray2));
masterWorkbook.Combine(secondWorkbook);
masterWorkbook.Save(filePath);
}
}
I am passing the files as byte arrays from a FileUpload control’s FileBytes property…
Many thanks,
Dan
Also to add, I have tried opening the workbooks straight from their filepaths and also moving the worksheets across one by one, but I get the same result:
public static void TestMergeFiles(string filePath1, string filePath2)
{
//Instantiate the License class
Aspose.Cells.License licenseCells = new Aspose.Cells.License();
//Pass only the name of the license file embedded in the assembly
licenseCells.SetLicense(“Aspose.Total.lic”);
string filePath = Path.GetTempFileName() + “.xlsx”;
Workbook masterWorkbook = new Workbook(filePath1);
Workbook secondWorkbook = new Workbook(filePath2);
WorksheetCollection wksheets2 = secondWorkbook.Worksheets;
foreach (Worksheet wks in wksheets2)
{
masterWorkbook.Worksheets.Add();
int wksIndex = masterWorkbook.Worksheets.Count - 1;
masterWorkbook.Worksheets[wksIndex].Copy(wks);
}
masterWorkbook.Save(filePath);
}
Hi,
I am unable to use the new dll because my subscription only allows older versions.
Thanks for your assistance anyway.
Cheers,
Dan
Hi,
Hi,
I have recently purchased a new licence and retried your suggested code with the latest version of Aspose Cells.
Unfortunately, this error still remains.
The master workbook holds its table name ok, but the table in the worksheets copied across, revert to “table2”.
Please see attached file.
Can you advise how to accomplish this please?
Many Thanks,
Dan
Hi Dan,
Hi Dan,
Thanks for using Aspose.Cells.
We have fixed this issue.
Please download and try the fix: Aspose.Cells
for .NET v7.7.0.4 and let us know your feedback.
Hi,
Yes thanks that fixes the issue with resetting table names.
However, I have found another problem:
When there is a table referenced in a formula, it corrupts the sheet.
Please find attached amended files…
In particular, see the formula in column G that causes the bug.
Many Thanks,
Dan
Hi,
The issues you have found earlier (filed as CELLSNET-42273) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan