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

New Post: Issue while copying worksheets

$
0
0
Okay good people, I've got some good news and some bad news.

The good news is that I just committed a quick fix to the ws copying issue. I don't have your file manjunathg88 so test it.

cooper,

The rows and columns are copied because they contain information like height and width.

In your case you would also want to copy the workbook's named ranges. You can do it with the following code (after copying the worksheets)
foreach (var r in wbSource.NamedRanges.Where(nr => nr.Name != "CellHasFormula"))
{
    wbTarget.NamedRanges.Add(r.Name, r.Ranges);
}
The reason why I'm excluding the CellHasFormula range is because it refers to "NOT(GET.CELL(48,INDIRECT("rc",FALSE)))" and I have no clue how to deal with this kind of named range (the bad news).

So pick up the lates code and let me know if you guys have questions.

/Manuel

Viewing all articles
Browse latest Browse all 1877

Trending Articles



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