Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Unassigned: ClosedXML does not preserve style [9454]

$
0
0
So this is my code

```
using (var document = new XLWorkbook(root + outFolder + copied))
{
var sheet = document.Worksheets.First();
var allRows = sheet.Rows();
foreach (var currentRow in allRows)
{
var allCells = currentRow.Cells();
foreach (var cell in allCells)
{
var cVal = cell.Value.ToString();
if (dict.ContainsKey(cVal))
{
cell.Value = dict[cVal];
}
}
}
document.SaveAs(root + outFolder + copied);
}
```

This is how the Excel file looked before editing with ClosedXML: http://i.imgur.com/jjBWsUJ.png

This is how it looks after: http://i.imgur.com/qH8DrhO.png

As you can see, there are a bunch of styles it isn't saving. OpenXML does not do this.
Comments: Thanks for the reply. There is a blueprint that I use (it's the blue logo top left corner) which is automatically added to every page. ClosedXML preserves all styles perfectly except for the "blueprint."

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>