HTML to Excel: How can tell Excel to treat columns as numbers?

前端 未结 7 979
半阙折子戏
半阙折子戏 2020-12-04 18:42

I need to achieve the following when opening an HTML in Excel (Response.contentType=\"application/vnd.ms-excel\") :

  • force Excel to consider conten
相关标签:
7条回答
  • 2020-12-04 19:09

    The best trick is to mock up an Excel spreadsheet with all the colors/(conditional) formats/formulas you require.

    Keep it as simple as possible, just the bare minimum rows etc.

    Then save the Excel spreadsheet "As Xml Spreadsheet"

    Then you have a template to build a spreadsheet via Xml.

    I generally clean up styles in the original Xml saved from the Excel workbook. Removing duplicates and renaming them.

    Then it is just a matter of populating with whatever datasource you have.

    I do not know what environment you are coding to, but in VB.NET with LINQ and Xml Literals, this is a very simple task.

    0 讨论(0)
提交回复
热议问题