Giter Site home page Giter Site logo

excel-html-tools-public's People

Contributors

heimmatthias avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

salah1120202019

excel-html-tools-public's Issues

Limitations with empty cells and rows omitted

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:
https://imgur.com/a/bkjvLjO

<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.

Inheritance of style presets from style templates

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.

Limitations cell formats can be inherited despite being switched off on cell

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.

Limitations in conversion of formatted numbers

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.

Handling of multiple cells with deviations from same style-preset

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:

  • either only apply the transformation to individual cells and combine them into a unified table yourself, but make sure to untangle conflicting class-styles from the different cell-transformations (which will still receive the same class-name)
  • or adjust the XSLT to no longer remove these CSS-entries from the stylesheet but include checks to insert the negating style-entries into the cell's style-attribute (i.e. <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.

Limitations in conversion of underline and strike-through effect

  • Underline-color (or line-through) of characters does not always take the color of the character. This is because Excel treats this as a character-style, whereas html derives the underline-color from the currentColor of the U-node.
  • Line-through and underline in Excel are always under/through the character. In html this depends on the nesting of the nodes.
    Consider the difference between <sup><del>1</del></sup> and <del><sup>1</sup></del>
    The first renders correctly as 1, but the second renders like an underline in Excel: the height of the line-through effect orients itself with regards to the baseline of the outer tag. The xsl-transformation does not attempt to reorder node nesting and simply adopts them from Excel. This might produce the desired result sometimes. If this is important for you consider addressing it with either css (partial solutions possible) or by re-nesting these nodes yourself. For your orientation: problems might arise with 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.

open and closed replaced with &gt;&lt;

Hi,
Greetings,
Html transformation not work properly . some html tags have issue.
please find


&lt;/style&gt;
&lt;div id="Sheet1"&gt;
&lt;table class="default"&gt;
&lt;tr&gt;
&lt;td class="s22" style="font-weight:normal;color:#000000;"&gt;&lt;b&gt;&lt;span style="color:#4472C4;"&gt;قطن طبى فائق الامتصاص 500 جم&lt;/span&gt;&lt;br&gt;لجميع الاغراض الطبيه&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;


Limitations to cell-background and cell-borders

  • Only plain-color cell-background is supported. Patterns could in theory be implemented, but would require svg-background patterns for all possibilites. I suggest to solve this yourself with class-styles. Gradient-backgrounds could easily be implemented in html, but unfortunately they are not represented in Excel's XML-cell representation.
  • Cell borders are represented if possible. Some border-styles (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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.