如何将Div的内容导出到Ms Word? [英] How Can I Export The Content Of A Div To Ms Word?
问题描述
我想将内容导出到我的视图页面div中的word文件。一旦我尝试,word文件导出与html标签(div)。我怎样才能摆脱那些html标签并显示确切的内容。请提供示例代码。
谢谢。
Hi,
I want to export the content to word file which is in a div in my view page. Once when i tried, the word file got exported with html tags(div). How can i get rid of those html tag and show the exact content.Please provide sample code.
Thanks.
推荐答案
您可以使用RegExp:
You can use RegExp for it:
public static string removeHtml(string input)
{
return Regex.Replace(input, "<.*?>", String.Empty);
}
您可以在此处找到更详细的摘录。 / a> [ ^ ]。
还有一篇文章,删除全部HTML标记并仅在内部显示纯文本(如果XML格式不正确) [ ^ ]。
将div内容导出为MS Word:使用HTML& amp;动态生成MS Word文档。 CSS [ ^ ]
-KR
You can find more detailed snippet here[^].
And one article too, Remove all the HTML tags and display a plain text only inside (in case XML is not well formed)[^].
For exporting your div content to MS Word: Dynamically generate a MS Word document using HTML & CSS[^]
-KR
这篇关于如何将Div的内容导出到Ms Word?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!