如何将OMML转换为IMAGE

时间:2013-06-28 09:30:21

标签: xslt mathml omml

我遇到了将OMML(开放式办公室中的Math XML)转换为图像的问题。

此功能在我正在进行的项目中,应该部署在Linux上。为了提高效率,我应该选择一种没有MS产品的方法(例如dll,MS Office扩展等)。

显示一些调查结果:

  1. OMML可以转换为MATHML(通过XSLT),然后我可以转换 MATHML图像(由jeuclid)。
  2. OMML可以翻译成LaTex(通过 XSLT或writer2tex),然后我可以将LaTex转换为图像(通过texvc的 的mediawiki)。
  3. 但是,所有这些解决方案都依赖于第三软件或XSLT。有没有更好的方法来进行这样的转换?

2 个答案:

答案 0 :(得分:0)

我只想编写一个宏,将OMML导入OOo / AOO / LibreOffice绘图并将其导出到png,例如。

网上有很多关于如何将OpenOffice宏与过滤器一起使用的例子。

您可以从命令行运行openoffice宏。

像这样的东西,我没有时间去研究它,对不起......

Sub Macro1(outfile, formula)
   ' Create a drawing.
   oDoc = StarDesktop.loadComponentFromURL( "private:factory/sdraw", "_blank", 0, Array() )
   ' Get the first page.
   oDrawPage = oDoc.getDrawPages().getByIndex( 0 ) 
   ' Input and output files - to be converted to URL's
     iURL = ConvertToURL(formula)
     oURL = ConvertToURL(outfile)
   ' Get a position in the drawing (not sure this works in draw, it does in writer)
   set oViewCursor = objDocument.CurrentController.getViewCursor()
   set oTextCursor = objDocument.Text.createTextCursorByRange(oViewCursor.getStart())
   'insert formula
   oTextCursor.InsertDocumentFromURL iFile, Array() 
      ' Save the document using a filter.
   oDoc.storeToURL(oURL, Array(MakePropertyValue("FilterName", "draw_png_Export"), ))
End Sub

要从命令行运行它,请使用以下命令:

sdraw -invisible" macro:///Standard.Module1.ConvertWordToPDF(' c:\ formula.odf',' c:\ image.png')& #34;

此致

HP

答案 1 :(得分:0)

这是我发现的最简单的解决方案,使用libreoffice的无头选项:
1.找到doc文件所在的文件夹(即test.doc)
2.如果Libreofffice正在运行,请将其关闭。否则,以下命令将不执行任何操作 3.运行以下命令(在debian和libreoffice 3.5中,其他操作系统和版本可能不同)

libreoffice --headless --convert-to html --outdir out test.doc

  1. 探索out dir,你将在base64中找到包含图像的html文档。
  2. 制作自己的脚本以自动执行上述步骤。
相关问题