从Html源创build评论在Excel中

所以,可以从Html创build一个excel文件。 而且我发现许多事情都是可能的,比如像添加图像,格式化等等,只需要一些css的调整。

但是,我现在想要做的是得到小红色的三angular形评论来显示。

我创build了一个空白的excel文件,只有一个注释,但它生成的HTML是一团糟。 我相信其中很多是多余的。 有没有人做过,或知道如何才能使它工作?

如果它像<td title="comment">text</td> ,但它不是。

编辑:我有所需的基础知识,以便在excel中加载时显示一个评论修剪到这…我只需要看看我是否可以修剪vml下来更简单。

看来它连接的单元的链接也是这样的:0 0

现在,我只需要正确定位,最初

我认为这是最低限度的,我已经通过稍微修改html添加了第二个评论。

但是,如果你能帮助进一步调整,这将是非常有帮助的

 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <body> <table> <tr> <td>cell 1</td> </tr> <tr> <td></td> <td></td> <td></td> <td>cell 3</td> </tr> </table> <div style='mso-element:comment-list'> <div style='mso-element:comment'> <!--[if gte mso 9]> <xml> <v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"> <v:stroke joinstyle="miter"/> <v:path gradientshapeok="t" o:connecttype="rect"/> </v:shapetype> <v:shape id="_comment1" type="#_x0000_t202" style='width:96pt;height:55.5pt;z-index:1;visibility:hidden' fillcolor="infoBackground [80]" o:insetmode="auto"> <v:textbox style='mso-direction-alt:auto'/> <x:ClientData ObjectType="Note"> <x:Row>0</x:Row> <x:Column>0</x:Column> </x:ClientData> </v:shape> <v:shape id="_comment2" type="#_x0000_t202" style='width:96pt;height:55.5pt;z-index:1;visibility:hidden' fillcolor="infoBackground [80]" o:insetmode="auto"> <v:textbox style='mso-direction-alt:auto'/> <x:ClientData ObjectType="Note"> <x:Row>1</x:Row> <x:Column>3</x:Column> </x:ClientData> </v:shape> </xml> <![endif]--> <div v:shape="_comment1" > This is a comment </div> <div v:shape="_comment2" > This is another comment </div> </div> </div> </body> </html> 

有没有简单的方法,我已经能够确定。 但是这是一个复杂的方式:

  1. 把你的简单的HTML文件,并在Excel中打开它。
  2. 给一个单元添加评论。
  3. 保存它,保存html格式。

这并不简单的原因是,Excel实际上在这一点上做的是创build一个文件夹,其中包含一些支持文件和原始文件的新版本 – 本质上是Excel文件的HTML表示。 如果您使用支持文件重新打开此文件,您将收到您的评论。

这告诉你的是,有一个预期的HTML格式(虽然它不存在于一个单一的文件),给你你的评论,你只需要逆向工程。

那可能吗? 是。 这是值得的麻烦? 那么,鉴于微软从来没有写过一百行代码,他们不能写成一千个 – 几乎肯定不是。

不过,我很好奇你还能做些什么。 我已经把这个答案作为一个社区维基,所以如果你有兴趣,你可以分享它。

我认为这是最低限度的,我已经通过稍微修改html添加了第二个评论。

 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <body> <table> <tr> <td>cell 1</td> </tr> <tr> <td></td> <td></td> <td></td> <td>cell 3</td> </tr> </table> <div style='mso-element:comment-list'> <div style='mso-element:comment'> <!--[if gte mso 9]> <xml> <v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"> <v:stroke joinstyle="miter"/> <v:path gradientshapeok="t" o:connecttype="rect"/> </v:shapetype> <v:shape id="_comment1" type="#_x0000_t202" style='width:96pt;height:55.5pt;z-index:1;visibility:hidden' fillcolor="infoBackground [80]" o:insetmode="auto"> <v:textbox style='mso-direction-alt:auto'/> <x:ClientData ObjectType="Note"> <x:Row>0</x:Row> <x:Column>0</x:Column> </x:ClientData> </v:shape> <v:shape id="_comment2" type="#_x0000_t202" style='width:96pt;height:55.5pt;z-index:1;visibility:hidden' fillcolor="infoBackground [80]" o:insetmode="auto"> <v:textbox style='mso-direction-alt:auto'/> <x:ClientData ObjectType="Note"> <x:Row>1</x:Row> <x:Column>3</x:Column> </x:ClientData> </v:shape> </xml> <![endif]--> <div v:shape="_comment1" > This is a comment </div> <div v:shape="_comment2" > This is another comment </div> </div> </div> </body> </html> 

这是非常及时的,非常感谢! 我刚刚实施,似乎工作正常。 最大的问题是必须预先确定“flex”为我的行和列。 我正在查看是否可以使用锚而不是行和列。