<![endif]–>
Hi,
In our code we merging excel files into one file. One of the files contains the chart and after merge this chart gets wrong data source. Please take a look on attached files before merge and also take a look on code:
private void Button_Click_3(object sender, RoutedEventArgs e)
{
Workbook1 workbook = null;
List<string> paths = new List<string>{"1.xlsx","2.xlsx"};
foreach (var excelPath in paths)
{
if (excelPath != null && File.Exists(excelPath))
{
if (workbook == null)
workbook = new Workbook1(excelPath);
else
{
var opened = new Workbook1(excelPath);
foreach (Worksheet ws in opened.Worksheets)
{
string uniqueName = ws.Name;
workbook.Worksheets.Add(uniqueName);
workbook.Worksheets[uniqueName].Copy(ws);
}
}
}
}
if (workbook != null)
{
if (workbook.Worksheets.Count > 0)
workbook.Worksheets[0].IsSelected = true;
workbook.Save("Merged.xlsx",SaveFormat.Xlsx);
}
}