C# Excel Add In: Get active worksheet as XML -


i have working word add in, saves selected part of document (including images, tables, etc) xml string in database. add in can retrieve saved xml strings , insert current position of open document, preserving styling , formatting.

i want same excel. want xml string represents active worksheet, save database , later retrieve xml string , insert worksheet active workbook.

the problem is, can't figure out how obtain xml string, nor can figure out how insert worksheet. have been experimenting , searching hours, no avail.

getting active sheet seems easy:

dynamic sheet = globals.thisaddin.application.activesheet; 

but haven't been able further.

for reference, how got xml string in word:

microsoft.office.interop.word.selection currentselection = globals.thisaddin.application.selection; string xmlstring = currentselection.xml; 

to insert it, used:

string xmlstring = ...; // read string database. microsoft.office.interop.word.selection currentselection = globals.thisaddin.application.selection; currentselection.insertxml(xmlstring); 

take in this sample. in sample converting excel sheet datatable iterating on rows , cells , converting datatable string.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -