So instead of all the past hacking data into variable-value txt-files or rolling my own XML structure I decided to look at Excels own XML Format since the spreadsheet is still editable in Excel leaving our text department with a well known frontend.
Getting the row/column/cell placement right was a bit of an adventure because Excel only generates nodes and attributes for them if they
a)have a defined width other than the standard or
b)are placed at a position (index)in the table that is different from their position in the node or
c)are repeated in the next/following coulumns respective their (other than standard) width as expressed with an attribute named "Span"...
Cells in a row can have a "MergeAcross" and a "MergeDown" attribute that needs to be handled so the next cell is placed at the proper column / the next row doesn't screw up with the cell placement/indexing.
Once I got a grip on that It was merely a matter of attribute checking to make the table appear like in Excel.
Some Style parsing later I had the basic formatting of the Excel cells showing up in Flash:
I read out the Font, Fontsize and Fontstyle (b,i,u) as well as the cell color and if it has borders.
As to the borders I only look up if the cell has a border tag since Flash TextFields do not specify on top,right,bottom and left borders and for the time being I didn't put in my own border drawing (KISS).
Anyway, ...drummroll... heres 2 pictures off a spreadsheet in Firefox(Flash) and Excel.
ps:the Flash Version implements BrowserCanvas. That is no Flash Scrollbar hazzle-make use of the browser window to adapt to your dynamic Flash content.
Yeah! Mr. White! SCIENCE! I ♥ that!
pps: I added cell align after Screenshots. excuse the laziness.
ppps: Since the code for this class was written at work, I cannot provide you with the source atm. sorry!
Keine Kommentare:
Kommentar veröffentlichen
You might as well leave a comment on this matter: