0

I have a two dimentional array formed by iterating a data reader. Earlier i was using automation to write to excel and using range, i was able to write the contents of two dimentional array to excel in one shot. This improves the performance a lot because of only one interaction with excel. but came across a problem that my server does not have office installed, so am trying a different alternative using openxml(as i justneed to install only one dll in this case).

Online i saw few example of using the openxml, but i am not sure if there is a way to directly transfter the contents of two dimentional array to the worksheet. i don't want to iterate the datareader and update each cell by cell as i have 65 columns and almost 90000 rows.

So does the SDK offer any inbuild command to do this?

Kara
  • 6,115
  • 16
  • 50
  • 57
user1447718
  • 669
  • 1
  • 11
  • 23

1 Answers1

0

you should't fear the iteration because there's no longer an "interaction with excel" dcom penalty. The open xml is just writing to a stream, which you can buffer to save flushing to disk.

fyi i've personally used closed xml (nuget @ http://nuget.org/packages/ClosedXML ) to create Excel files and found it much better than working with the raw Open XML standard.

finally, even if you had excel on the server you should never use excel as a dcom server in a no UI environment.

Chris DaMour
  • 3,650
  • 28
  • 37
  • i have 90000x65 table, so is it okay to iterate each cell and add them to excel? is there any example that i can see for nuget? – user1447718 Jan 12 '13 at 16:12
  • yeah the size doesn't matter to the closedXML api. you still have to flush to disk to avoid memory concerns. closedxml is doc'd at http://closedxml.codeplex.com/documentation – Chris DaMour Jan 14 '13 at 15:44