Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Set Spredsheet Column Width via XML  RSS feed

 
Pat Flickner
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hava a Java process that builds an XML file for a spreadsheet from the data passed to it using the SAX parser. Works great, except for one thing: Column width is at the smallest default (8.43). Is there a way via XML to tell Excel that the column width has to be larger? I've tried adding column-width, colWidth, and even trying to bypass the thing altogether using colspan="2". It compeltely ignores it althought it uses the colspan for a segment of the title informtion. (I'm at a loss to explan <i>that</i> one). We're not using an xsl with the process and I'm not sure how I would go about building one. I don't even know why they went to XML except that it does seem to be a bit faster for downloading since it's text as opposed to Excel encryption.

If this were POI, I'd be fine setting the column width (speaking of which, I found that sometimes the formula they give to determine column width doesn't necessarily work all the time; I noticed that they said that the value "1" is actually 1/256 of a character, so I just multiplied the width I wanted the column to be by 256 and it works just fine). I appreciate any help. Thanks.

Pat
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - this isn't something I've personally used, and I'm not sure if you've tried this already - but I found this tutorial on Microsoft's site that mentions setting column witdths in Excel using XML data.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!