VB question

Feb 12, 2011 at 1:18 PM
Edited Feb 12, 2011 at 1:22 PM

Hi, everyone,

I'm trying to use ExtremeML (and to avoid kilometers of code using DocumentFormat.OpenXML) in  ASP.NET application written in VB. Here's the piece of code:

 

Dim eml As ExtremeML.Packaging.SpreadsheetDocumentWrapper = ExtremeML.Packaging.SpreadsheetDocumentWrapper .Open(strFileLocation)

Dim tbl As ExtremeML.Spreadsheet. TableWrapper

tbl=eml.WorkbookPart.WorksheetParts("s1").WorkbookPart.GetTablePart("Listing").Table  

tbl.Fill(DbArchivesDataSet.tblObjects)

I've checked everything, code is perfectly working (document is opened, var tbl gets that table part) except the last line. There is no error, just the data from datatable could not be written into Excel file. I've tried numerous ways, what I see as a general problem that I could read data from spreadsheet document but in no ways I could write to it.

I've tried C# code, it works great but unofortunately, I need to stick with VB.

If you have any suggestion, please, post it. Thanks in advance!

 

 

 

 

 

 

Coordinator
Feb 12, 2011 at 2:21 PM

This is such a simple scenario, I can't imagine why it wouldn't work. However, it's been a very long time since I used VB.NET, so I am not the best person to advise.

Have you tried running your C# code through one of the online converters, like ...

http://www.developerfusion.com/tools/convert/csharp-to-vb/

Maybe someone else here has a better idea?

Good luck,

Tim

Feb 13, 2011 at 8:37 AM
Edited Feb 13, 2011 at 8:39 AM

You were right, converter did the job:

Using eml = SpreadsheetDocumentWrapper.Open(strFileLocation)

Dim tbl=eml.WorkbookPart.GetTablePart("Listing").Table  

 tbl.Fill(DbArchivesDataSet.tblObjects)

 

End Using 

 

 Although it's kind of weird, because it's pretty much the same code. Anyway, thank you very much for your suggestion!

 

 

 

 

 

 

Feb 28, 2011 at 4:33 PM

Well actually, in the original code you are getting the table from the Sheet, while in the sample and the converted code you use GetTablePart from the base DocumentWrapper.

Not sure if that was the problem.

Rgds,

Anand