目次

HTML ファイル

 

  AfxCore.rtf などのリッチファイルを Word で変換した HTML ファイルは全てのページが連結された1頁のファイルになります。

 

 テキストファイルとして見た全体構造は、ヘッダー部、頁記述部、脚注部 から成り、幾つかのキーワードで区分できます。

 

 ヘッダー

<div class=Section1>

 1ページ

<br clear=all style='page-break-before:always'>

 2ページ

<br clear=all style='page-break-before:always'>

 ・・・

<br clear=all style='page-break-before:always'>

 ・・・

<div style='mso-element:footnote-list'><![if !supportFootnotes]><br clear=all>

 脚注

 

 まずヘッダーを分離し、余分と思われる項目を消去し、各頁のヘッダとします。

 ここから脚注記号、頁 ID 、などを抽出し、消去とリンクの書き換えが必要です。

 次に頁の分割です。 ID をファイル名として分離保存します。不要なコードの削除も必要。

 

 ところが、 HTMLファイルというのは千差万別で、多様な記述になっています。途中で改行されていたり、ホワイトスペースが入ったり、記述文字列がバラバラに分けられたり。

 

 脚注の呼び方も下記のように異なります。

<div style='mso-element:footnote-list'>  だったり <div style='mso-element:endnote-list'>  だったり。

 

 文字列は >***< のところに入っていますが、一体のものとバラバラのものと色々。二重下線は文字列の前に double'> が入っていますがバラバラ文字列の場合はとても複雑。 double'> の効果が後の文字列にわるさをしないように </a> の追加が必要だったり。   

 文字列 “ [開く ... ]コマンド ”もどうかするとこういう具合。

 

<u style='text-underline:do****' ><span lang=EN-US> [ </span></u></span><b><span

style='font-size:12.0pt;font-family:"MS ゴシック ";mso-ascii-font-family:"MS P ゴシック ";

mso-hansi-font-family:"Times New Roman"'> 開く </span></b><b><span lang=EN-US

style='font-size:12.0pt;font-family:"MS P ゴシック ";mso-fareast-font-family:"MS ゴシック ";

mso-hansi-font-family:"Times New Roman"'> ... </span></b><u style='text-underline:

do**** '><span lang=EN-US style='font-size:12.0pt;font-family:"MS P ゴシック ";

mso-fareast-font-family:"MS ゴシック ";mso-hansi-font-family:"Times New Roman"'> ] </span></u><u

style='text-underline:do**** '><span style='font-size:12.0pt;font-family:"MS ゴシック ";

mso-ascii-font-family:"MS P ゴシック ";mso-hansi-font-family:"Times New Roman"'> コマンド </span></u><span

lang=EN-US style='font-size:12.0pt;font-family:"MS P ゴシック ";mso-fareast-font-family:

"MS ゴシック ";mso-hansi-font-family:"Times New Roman"; HID_File_OPEN </span><span

 

 各種パターンに対応するにはかなりの工夫が必要です。