简体   繁体   English

(Microsoft Excel)将html标记添加到单元格

[英](Microsoft excel) Adding html tags to cells

I'm trying to figure out how do i add for example <p> and </p> at the beginning and the end of my cell data. 我试图弄清楚如何在单元格数据的开头和结尾添加例如<p>和</ p>。 So my data looks like this, example: 所以我的数据看起来像这样,例如:

Before: Los Angeles 之前:洛杉矶

After: <p> Los Angeles </p> 之后:<p>洛杉矶</ p>

I have a whole table with tons of content to be converted in this way. 我有一张整张桌子,上面有很多内容要通过这种方式转换。 I would appreciate the help 我会很感激的

Excel is not a good HTML construction tool. Excel不是一个好的HTML构造工具。

If you want to concatenate html tags with contents of Excel cells you can construct the final html string using the & operator between bits of text, like this: 如果要将html标签与Excel单元格的内容连接起来,可以使用&运算符在文本的各个位之间构造最终的html字符串,如下所示:

="<p>"&A1&"</p>"

Edit: if you need to include formatted dates in this construct, you may want to look at the Text() function, like below. 编辑:如果需要在此构造中包含格式化的日期,则可能需要查看Text()函数,如下所示。 Adust to the format you need. 根据您需要的格式进行调整。

=TEXT(A1,"dd mmm yyyy")

在此处输入图片说明

Format the cell's value with TEXT using a custom format mask. 使用自定义格式掩码,使用TEXT格式化单元格的值。 The backslash can be used as an escape character to avoid conflict with reserved formatting characters. 反斜杠可用作转义符,以避免与保留的格式设置字符冲突。

=TEXT(A1, "\<\p\>@\<\/\p\>")

This format mask could also be used as a cell's custom number format. 此格式掩码也可以用作单元格的自定义数字格式。

在此处输入图片说明

<p>Los Angeles</p>
<p>Melbourne</p>
<p>Vancouver</p>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM