Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem With Converting XML to SpreadsheetML

Status
Not open for further replies.

prgmrgirl

Programmer
Feb 12, 2004
119
US
Howdy All,

This is a weird one:

I have a simple XML file and I want to turn it into Excel via XSL. I can do this without a problem except for a couple of strange things...

For some reason, the following will not work:
Code:
<Column ss:AutoFitWidth="1"/>

No error, it just doesn't autofit the column.

Weirdness number 2 is that I cannot use styles. Normally, you declare the <style> up in the <styles> element, like so:
Code:
<Styles>
<Style ss:ID="s21" ss:Name="Labels">
<Alignment ss:Vertical="Bottom" />
<Borders />
<Font ss:Bold="1" />
<Interior />
</Style>
</Styles>

Then you use it like this:
Code:
<Cell ss:StyleID="s21"><Data ss:Type="String">Foo</Data></Cell>

But I get the following error:
XML ERROR in Table
REASON: Bad Value
GROUP: Row
TAG: Cell
ATTRIB: StyleID
VALUE: s21

Thinking that maybe I had it wrong, I created a quick workbook, saved as spreadsheetML and took a look at how styles were applied. They were applied exactly like I have it above. I even copied and pasted the style so that I would know that it wasn't a typo or something silly like that. The element works fine when its generated by Excel. Does not work when its put into my xsl. [sad]

Does anyone know what the problem could be here? Is there maybe a setting or something that I need to set?

This one is a real puzzle...

Thanks!
prgmrgirl
 
**UPDATE**

Found the problem with using style:

I had accidently put <Workbook> BEFORE <xsl:template match="/">.

D'oh!

Still can't figure out why <Column ss:AutoFitWidth="1" /> isn't working though. [sad]
 
Hey Tom,

I know its not working because the column is not coming up as being autofitted even though the AutoFitWidth is set to 1 in the xsl.

The default is <Column ss:AutoFitWidth="0" />.

Normally you would set the width yourself like this: <Column ss:Width="200" />

Not really sure why Autofit is not autofitting the column...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top