有这样一个网页,前台部分代码如下。
...........
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showProcessingMessages: false,
messageStyle: "none",
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ["$", "$"] ],
displayMath: [ ["$$","$$"] ],
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre','code','a'],
ignoreClass:"comment-content"
},
"HTML-CSS": {
availableFonts: ["STIX","TeX"],
showMathMenu: false
}
});
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="report_body_panel" runat="server">
<p>
9.下列二次根式中,与$\sqrt{5}$是同类二次根式的是( )
</p>
<p>
<br />
</p>
<p>
<br />
</p>
<p>
A.$\sqrt{18}$ B.$\sqrt{\frac{5}{2}}$ C.$\sqrt{20}$ D.$\sqrt{0.5}$
</p>
</div>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</form>
</body>```
这段代码经过mathjax渲染后,在前台是能正常显示数学公式的。现在我想用aspose.word将
<div id="report_body_panel" runat="server">数学公式latex代码</div>
里面的内容导出保存为word.该怎么做呢,求高手指点。万分感谢!
我又作了这样的尝试,
protected void Page_Load(object sender, EventArgs e)
{
this.Literal1.Text = @"A.$2\sqrt{2}$B.$3\sqrt{2}$C.4D.16";
}
protected void Button1_Click(object sender, EventArgs e)
{
Aspose.Words.Document wordDoc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(wordDoc);
string html = this.Literal1.Text;//这是html文本
builder.InsertHtml(html);
wordDoc.Save("D:\\test.doc", SaveFormat.Doc);
}
但是这样保存下来的是字符串的内容而不是公式!!!!!是哪里出了问题呢?