heimmatthias / excel-html-tools-public Goto Github PK
View Code? Open in Web Editor NEWVBA-scripts for rich-text HTML-Export from Excel
License: GNU General Public License v3.0
VBA-scripts for rich-text HTML-Export from Excel
License: GNU General Public License v3.0
Empty cells (and lines) are skipped over, and are not copied as cells to html. This may result in wrongly aligned columns in the output.
This is difficult to address, since the xml, Excel forwards to the xsl transformation omits empty cells already and only includes the column-numbers via a property, e.g.
<Row>
<Cell ss:Index="2">B2</Cell>
</Row>
This could be parsed but the xslt would become much more complex. Moreover, under some circumstances Excel does not return the required information for parsing empty rows correctly. Consider the simplified xml for the following example across range B2:C3:
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="2">
<Row>
<Cell ss:Index="2">C3</Cell>
</Row>
</Table>
You may note that the information for the empty cell B3 can be retrieved from the ss:Index-Attribute of cell C3, but there is absolutely no information about the dropped row.
Solution: circumvent the problem by filling empty cells with a space character.
This has the advantage of keeping the xsl-code clean and working under all circumstances. The included helper script turnSelectionNumbersIntoText()
will do this for you (among other transformations, see #6), but note that this permanently changes the content of your worksheet.
When applying the same style template to multiple cells and including formatting exceptions in any of the cells, style will be inherited across multiple style entries in the xml.
e.g.
<Style ss:ID="s20" ss:Name="Gut">
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#006100"/>
<Interior ss:Color="#C6EFCE" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s105" ss:Parent="s20">
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="12" ss:Bold="1"
ss:Italic="1" ss:StrikeThrough="1" ss:VerticalAlign="Superscript"
ss:Underline="Single"/>
</Style>
in this example, the cell refers to ss:StyleID="s105"
, but should also inherit the template name (as a class name) and the styles from style ss:ID="s20"
. Yet currently it only receives formatting from the direct style linked via the ss:StyleID
-attribute.
If you apply a style template to a cell and then turn of some of the formats for the entire cell, then these will still be exported.
This is because the cell will include the class name of the style-template and will therefore inherit its features. For font and character-level styles the xslt will turn of styles that should not be inherited by stipulating a default value in the separate style-entry for the cell. But this additional check has not been implemented for backgrounds, borders and cell alignment.
This is a borderline situation that rarely arises in production. There are no plans to fix this.
Feel free to submit a patch.
No formatted numbers or formula calculations are converted to html
While Excel's xml contains the required information to turn formatted numbers into strings, it seems near impossible to parse this information using XSLT1.0. You could hardcode some of the more obvious formats, but this would still not resolve the myriads of language specific transformation possibilites (i.e. with dates).
Workaround solution: circumvent the problem by turning non-text cells into text prior to export.
This has the advantage of keeping the xsl-code clean and working under all circumstances. The included helper script turnSelectionNumbersIntoText()
will do this for you, but note that this permanently changes the content of your worksheet.
Some on/off-Tags, such as bold
(underline
or italics
), are difficult to implement when they derive from cell-styles (i.e. are set for the entire cell with exceptions on some characters added later). Excel checks in the rendering-process if there are individual bold elements inside the cell and then decides to use these tags to render bold passages, effectively disregarding the cell-style that calls for the entire cell to be in bold. This would not work in html.
The XSLT checks whether the first cell using a specific style contains the corresponding tag and omits the css-entry in the style-tag. This is then not applied to all cells using this format.
If this is a problem for you:
<td style="font-weight:normal"><b>bold</b> and not so bold text combined</td>
. If this is a requirement for you, feel free to open an Issue, and I'll try to help out.currentColor
of the U
-node.<sup><del>1</del></sup>
and <del><sup>1</sup></del>
sub
- or sup
-tags inside u
- or del
-tags.text-decoration: underline double;
and text-decoration: line-through single;
are mutually exclusive in css, but this effect can be achieved in Excel. The xsl-transformation opts for the closest match: text-decoration: underline line-through double;
. Note that this is only a problem if you opt to retain the style sheet. If you opt for a full transformation using excel-full-transformation.xsl, these styles are transformed into separate html-nodes with their own styles applied.These are border-line formatting cases, that are probably not relevant in real-life situations. There are no plans to resolve these.
Hi,
Greetings,
Html transformation not work properly . some html tags have issue.
please find
</style>
<div id="Sheet1">
<table class="default">
<tr>
<td class="s22" style="font-weight:normal;color:#000000;"><b><span style="color:#4472C4;">قطن طبى فائق الامتصاص 500 جم</span><br>لجميع الاغراض الطبيه</b></td>
</tr></table></div>
DashDotDot
, DashDot
, SlantDashDot
) cannot be represented with CSS and receive their closest match.These are limitations in the xml-representation of Excel and / or in the possibilites of html. There are no plans to resolve this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.