0

先週、私は WYSIWYG - cKeditor に取り組んでいました。疑問が頭に浮かびました。doc または docx ファイルのコンテンツをブロガーまたはワードプレスのテキスト領域に抽出または引き出す方法はありますか。たとえば、doc(x) ファイルからテキストや画像を選択してコピーする必要はありません。ファイルを WYSIWYG に渡すだけで、doc(x) ファイルの内容が投稿に貼り付けられます。

任意の提案をいただければ幸いです。ありがとう

4

1 に答える 1

1

編集: または、このプラグインを参照してください。

このプラグインは、アップロードされた .docx ファイルを処理し、すべてのコンテンツを投稿として抽出します。


PHPWordを使用して .docx ファイルの内容を抽出できると思います。

(おそらく、.docx ファイルは特定の構造を持つ単なる .zip ファイルであることに言及する必要があります。Open Office XML )

ただし、読み取りではなく .docx ファイルの書き込みに専念しているようです。

PHPWord_Templateにこれを含むクラスがあります__construct

$this->_objZip = new ZipArchive();
$this->_objZip->open($this->_tempFileName);

$this->_documentXML = $this->_objZip->getFromName('word/document.xml');

次のような XML ドキュメントを返します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
  <w:body>
    <w:p w:rsidR="005B1098" w:rsidRDefault="005B1098"/>
    <w:p w:rsidR="005B1098" w:rsidRDefault="005B1098">
      ...
      <w:r w:rsidRPr="00F15611">
        <w:rPr>
          <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:cs="Calibri"/>
          <w:lang w:val="en-GB"/>
        </w:rPr>
        <w:t xml:space="preserve">The following table contains a few values that can be edited by the PHPWord_Template class.</w:t>
      </w:r>
      ...
  </w:body>
</w:document>

その中にドキュメントのテキストがあります。

すべてのフォーマットを引き継ぐ場合、この方法を使用すると大変な作業になるようです。テキストフィールドにコピーして貼り付けるよりもはるかに多くの作業。

于 2010-12-28T23:13:22.287 に答える