leora
leora

Reputation: 196871

Can you populate a range in ClosedXML (C#)

I wanted to see if you can populate a range all at once from an array when using closedXML instead of populating a single cell at a time. Also, if it is possible to set a range from an array, would that be faster than looping through cell by cell and populating each cell?

Upvotes: 1

Views: 7678

Answers (2)

Manuel
Manuel

Reputation: 11489

You can do:

cell.Value = yourArray;

See the section "Inserting Data/Tables" of the Documentation.

Upvotes: 1

pabdulin
pabdulin

Reputation: 35255

You can try to insert data as a DataTable and see if it will speed up document creation. But as I can see in source code, there is no optimisation possible whatsoever against single cell population (but I can be wrong).

Upvotes: 3

Related Questions