私はfigure
、img
、figcaption
というタグを持つHTMLを持っており、それらをMicrosoft Word文書に変換したいと考えています。from <figure>と<figcaption>からMicrosoft Word
img
で参照される画像は、Word文書に挿入し、figcaption
はキャプションに変換する必要があります(Figure番号も保持してください)。
Word 2013でhtmlを開こうとしましたが、figcaption
はFigureキャプションとして変換されませんが、画像の下には単なるテキストです。
これを行うための最小限の作業サンプルがありますか?私はhttps://en.wikipedia.org/wiki/Microsoft_Office_XML_formats#Word_XML_Format_exampleを見ましたが、ちょうどHello worldサンプルをつかむのはあまりにも冗長です。あなたは "図1" と "図2" を見ることができるように私は、Windowsの
pandoc -f html -t docx -o hello.docx hello.html
が、運と上pandocてみました
figure .image {
width: 100%;
}
figure {
text-align: center;
display: table;
max-width: 30%; /* demo; set some amount (px or %) if you can */
margin: 10px auto; /* not needed unless you want centered */
}
article {
counter-reset: figures;
}
figure {
counter-increment: figures;
}
figcaption:before {
content: "Fig. " counter(figures) " - "; /* For I18n support; use data-counter-string. */
}
<figure>
<p><img class="image" src="https://upload.wikimedia.org/wikipedia/commons/c/ca/Matterhorn002.jpg"></p>
<figcaption>Il monte Cervino.</figcaption>
</figure>
<figure>
<p><img class="image" src="https://upload.wikimedia.org/wikipedia/commons/2/26/Banner_clouds.jpg"></p>
<figcaption>La nuvola che spesso è vicino alla vetta.</figcaption>
</figure>
が欠落しています。
マイpando Cは次のとおりです。
c:\temp>.\pandoc.exe -v
pandoc.exe 1.19.2.1
Compiled with pandoc-types 1.17.0.4, texmath 0.9, skylighting 0.1.1.4
Default user data directory: C:\Users\ale\AppData\Roaming\pandoc
Copyright (C) 2006-2016 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
編集1
それはそれを成し遂げるために、いくつかのC#を使用しても結構です。多分、私はC#プログラムを使ってHTMLをXMLのWord形式に変換することができます。
は、あなたが最新pandocバージョンを試してみましたか? – mb21
@ mb21私はそれが最新だと思うpandoc 1.19.2.1でテストしました。 –
それは奇妙です、私はLinuxで試したところ、画像をダウンロードし、それらをwordファイル(libreofficeで開かれたもの)に埋め込みました。だから多分窓のこと... – mb21