Here is the snippet I am trying to execute:
FinalDocument = new Workbook();
for (int i = 0; i < FinalDocument.Worksheets.Count; i++)
{
FinalDocument.Worksheets.RemoveAt(i);
}
var fileList = WorksheetNames.Select(w => w.Value).Distinct().ToList();
foreach (var file in fileList)
{
Workbook wb = new Workbook(_pitchSharedLocation + "\\" + file);
if (wb.HasExernalLinks())
{
wb.RemoveExternalLinks();
}
FinalDocument.Combine(wb):
}
List<string> notNeeded = new List<string>();
foreach (Worksheet sheet in FinalDocument.Worksheets)
{
if (!WorksheetNames.Keys.Contains(sheet.Name))
{
notNeeded.Add(sheet.Name);
}
}
foreach (string name in notNeeded)
{
FinalDocument.Worksheets.RemoveAt(name);
}
FinalDocument.Save(_pitchSharedLocation + "\\" + _finalDocumentName);
I have also attached the sample workbooks I am trying to merge (wb1.xlsx and wb2.xlsx), and the merged output (Document.xlsx). As you can see, the formatting of the output changes. Just compare SM sheet of wb1 and SM sheet of Document.xlsx. The black borders of the cells have changed to yellow, and the row width has also changed for row 5. Please tell me how to avoid this.
10.zip (803.5 KB)