2017-05-20 2 views
0

特定のスタイルが段落に適用されます。スタイルのフォントファミリーが何であるかを知りたい。私はdocxの中にstyles.xmlファイルを開こうとしました。多くのスタイルにw:ascii属性が設定されていません。たとえば、スタイルHeading1を考えてみましょう。このスタイルに対応するOOXMLは、フォントファミリを抽出するために何w:ascii属性が存在しないw:rFontsタグでOOXMLの段落でどのようなフォントファミリが使用されているかを調べる方法は?

<w:style w:type="paragraph" w:styleId="Heading1"> 
    <w:name w:val="heading 1"/> 
    <w:basedOn w:val="Normal"/> 
    <w:next w:val="Normal"/> 
    <w:link w:val="Heading1Char"/> 
    <w:uiPriority w:val="9"/> 
    <w:qFormat/> 
    <w:rsid w:val="00FB3E81"/> 
    <w:pPr> 
     <w:keepNext/> 
     <w:keepLines/> 
     <w:spacing w:before="240"/> 
     <w:outlineLvl w:val="0"/> 
    </w:pPr> 
    <w:rPr> 
     <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi"/> 
     <w:color w:val="2E74B5" w:themeColor="accent1" w:themeShade="BF"/> 
     <w:sz w:val="32"/> 
     <w:szCs w:val="32"/> 
    </w:rPr> 
</w:style> 

です。このスタイルのフォントファミリの詳細はどこに格納されていますか、それをJavaアプリケーションで使用するためにどのように抽出するのですか?私は、Apache POIを使って文書を解析しています。

+0

これは私が今やっていることです。 'w:basedOn'がなくなるまで階層構造を上げ、まだフォントが見つからなければ手動でデフォルトのフォントを設定します。 –

答えて

1

検査w:rFonts。この例では、w:asciiTheme="majorHAnsi"は、見出しに使用されるテーマフォントであるmajorHAnsiというテーマで定義されているフォントを使用していることを示しています。あなたは2つのフォント、majorFontminorFontを定義fontSchemeを見つけるテーマファイルで :だからtheme1.xml

編集である可能性が高いテーマファイルで指定されたフォントファミリを決定する必要があります。これらはmajorHAnsiminorHAnsiに対応しています。使用されているテーマがOffice付属の標準テーマの1つである場合、使用されている言語スクリプトに応じて多数のエントリが存在することがあります。

 <a:fontScheme name="Office Theme"> 
     <a:majorFont> 
      <a:latin typeface="Calibri Light" panose="020F0302020204030204" /> 
      <a:ea typeface="" /> 
      <a:cs typeface="" /> 
      <a:font script="Jpan" typeface="游ゴシック Light" /> 
      <a:font script="Hang" typeface="맑은 고딕" /> 
      <a:font script="Hans" typeface="等线 Light" /> 
      <a:font script="Hant" typeface="新細明體" /> 
      <a:font script="Arab" typeface="Times New Roman" /> 
      <a:font script="Hebr" typeface="Times New Roman" /> 
      <a:font script="Thai" typeface="Angsana New" /> 
      <a:font script="Ethi" typeface="Nyala" /> 
      <a:font script="Beng" typeface="Vrinda" /> 
      <a:font script="Gujr" typeface="Shruti" /> 
      <a:font script="Khmr" typeface="MoolBoran" /> 
      <a:font script="Knda" typeface="Tunga" /> 
      <a:font script="Guru" typeface="Raavi" /> 
      <a:font script="Cans" typeface="Euphemia" /> 
      <a:font script="Cher" typeface="Plantagenet Cherokee" /> 
      <a:font script="Yiii" typeface="Microsoft Yi Baiti" /> 
      <a:font script="Tibt" typeface="Microsoft Himalaya" /> 
      <a:font script="Thaa" typeface="MV Boli" /> 
      <a:font script="Deva" typeface="Mangal" /> 
      <a:font script="Telu" typeface="Gautami" /> 
      <a:font script="Taml" typeface="Latha" /> 
      <a:font script="Syrc" typeface="Estrangelo Edessa" /> 
      <a:font script="Orya" typeface="Kalinga" /> 
      <a:font script="Mlym" typeface="Kartika" /> 
      <a:font script="Laoo" typeface="DokChampa" /> 
      <a:font script="Sinh" typeface="Iskoola Pota" /> 
      <a:font script="Mong" typeface="Mongolian Baiti" /> 
      <a:font script="Viet" typeface="Times New Roman" /> 
      <a:font script="Uigh" typeface="Microsoft Uighur" /> 
      <a:font script="Geor" typeface="Sylfaen" /> 
     </a:majorFont> 
     <a:minorFont> 
      <a:latin typeface="Calibri" panose="020F0502020204030204" /> 
      <a:ea typeface="" /> 
      <a:cs typeface="" /> 
      <a:font script="Jpan" typeface="游ゴシック" /> 
      <a:font script="Hang" typeface="맑은 고딕" /> 
      <a:font script="Hans" typeface="等线" /> 
      <a:font script="Hant" typeface="新細明體" /> 
      <a:font script="Arab" typeface="Arial" /> 
      <a:font script="Hebr" typeface="Arial" /> 
      <a:font script="Thai" typeface="Cordia New" /> 
      <a:font script="Ethi" typeface="Nyala" /> 
      <a:font script="Beng" typeface="Vrinda" /> 
      <a:font script="Gujr" typeface="Shruti" /> 
      <a:font script="Khmr" typeface="DaunPenh" /> 
      <a:font script="Knda" typeface="Tunga" /> 
      <a:font script="Guru" typeface="Raavi" /> 
      <a:font script="Cans" typeface="Euphemia" /> 
      <a:font script="Cher" typeface="Plantagenet Cherokee" /> 
      <a:font script="Yiii" typeface="Microsoft Yi Baiti" /> 
      <a:font script="Tibt" typeface="Microsoft Himalaya" /> 
      <a:font script="Thaa" typeface="MV Boli" /> 
      <a:font script="Deva" typeface="Mangal" /> 
      <a:font script="Telu" typeface="Gautami" /> 
      <a:font script="Taml" typeface="Latha" /> 
      <a:font script="Syrc" typeface="Estrangelo Edessa" /> 
      <a:font script="Orya" typeface="Kalinga" /> 
      <a:font script="Mlym" typeface="Kartika" /> 
      <a:font script="Laoo" typeface="DokChampa" /> 
      <a:font script="Sinh" typeface="Iskoola Pota" /> 
      <a:font script="Mong" typeface="Mongolian Baiti" /> 
      <a:font script="Viet" typeface="Arial" /> 
      <a:font script="Uigh" typeface="Microsoft Uighur" /> 
      <a:font script="Geor" typeface="Sylfaen" /> 
     </a:minorFont> 
    </a:fontScheme> 
+0

theme1.xmlファイルを調べました。私はフォントを見つけることができません。そこにはmajorHAnsiプロパティはありません。 –

+0

回答が更新されました。 –

+0

これは、オフィスに来るテーマに適しています。しかし、第三者のテーマを得る方法はありません。 –

関連する問題