Question Exporting an XMLMap from an Excel Template

robjsmall

New member
Joined
Jan 14, 2010
Messages
2
Programming Experience
10+
Hi All,

I have an Excel Template file (.xlt) which contains an XML Map. The Map produces a more or less flat xml structure in the format: -

<worksheet>
<row>
<Field1/>
<Field2/>
<Field3/>
</row>
</worksheet>

If I click "Verify Map for Export" in the XML Source window within Excel, I get the message "messages_Map is exportable"

Therefore I'm as certain as I can be that the xlt is fine.

The problem is when I try to access that XML Map in VB.Net.

My code is as follows: -

Dim excelApp As New Excel.Application
Dim excelTemplateBook As Excel.Workbook

excelTemplateBook = excelApp.Workbooks.Open("MyTemplateFile.xlt")

Dim xmlString As String = ""
excelTemplateBook.XmlMaps(1).ExportXml(xmlString)

When I execute that last codeline I get the following error: -

"The map could not be exported, so the data was not exported.Use XmlMap.IsExportable to determine whether the map can be exported"

XmlMap.IsExportable is False, even though when I verified the map in Excel, the map was identified as Exportable.

Anyone seen this problem before and know what's causing it?

Cheers in advance,
Rob
 
Hi all,

I've found the cause of this problem, though haven't researched specifically what exactly caused it.

The .xlt I was using contained a few lines of header information and a few sum rows underneath the data section. I suspect it's these sum rows that were causing the problem.

To resolve the issue I recreated my template to include only data rows and knock out the header and footer stuff.

Maybe this info will help someone else who's experiencing the same.

Cheers
Rob
 
Back
Top