如何用基数,分子和分母写公式

比如带有根号,分子分母,以及上下标的公式怎么写入word呢?有相关文档啥的吗?

@Gavin_Zhang 比如带有根号,分子分母,以及上下标的公式怎么写入word呢?有相关文档啥的吗?

@tahir.manzoor比如带有根号,分子分母,以及上下标的公式怎么写入word呢?有相关文档啥的吗?

@LiuWeiming

您可以使用DocumentBuilder.InsertHtml方法插入MathML,如下所示。 希望对您有帮助。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(
    "<math xmlns = \"http://www.w3.org/1998/Math/MathML\">" +
    "<mfrac>" +
    "<msup>" +
    "<mn>5</mn>" +
    "<mfrac bevelled=\"true\">" +
    "<mn>6</mn>" +
    "<mn>7</mn>" +
    "</mfrac>" +
    "</msup>" +
    "<mn>8</mn>" +
    "</mfrac>" +
    "</math>");

doc.Save(MyDir + "output.docx");

@tahir.manzoor
太感谢了,用了一下,确实可以用。
还有一个小小的问题,矢量图应该怎么输出呢?
比如我想输出两条线,或者填充的矩形或三角形,图片放大缩小后不会失真。

@LiuWeiming

您能否与输入和预期输出一起分享有关查询的更多详细信息?

是否要将线矩形等形状输出到图像中?

@tahir.manzoor
要将线段或者多边形输出到图像中,给您发了一个邮件,类似附件中的word的例子

@LiuWeiming

请使用以下代码片段将Shape保存到图像中。 希望对您有帮助。

Document doc = new Document(MyDir + "input.docx");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
shape.GetShapeRenderer().Save(MyDir + "Shape.png", new ImageSaveOptions(SaveFormat.Png));