1

連絡先データベースから動的に生成するように OpenTBS をセットアップしました。ここで、電子メールの実際のコンテンツが、CKeditor または別の WYSISYG JS エディターを使用して作成された MySQL テーブルから取得されるようにセットアップしたいと考えています。

出力されたdocxファイルに表示するコンテンツを取得できましたが、これはhtmlタグのひずみとして来ています。これをフォーマットする必要があるため、クライアントによって入力されたとおりになります。基本、パラグラフ、ボールド、イタリック、その他いくつかのタグの使用のみを許可します。

このHTML文字列をワードコピー/テキストに変換できますか? または、どういうわけか別の WYSIWYG エディターを使用して、MySQL に HTML コードではなくワード コードとして保存します。

ありがとう

あまり関係ありませんが、以下はテンプレートとデータベースから OpenTBS ドキュメントを生成する関数です (私は CakePHP を使用しています)。

// FUNCTION EXPORT MAIL MERGE
// -------------------------------------------------------------->
function mail_merge()
{
     Configure::write('debug',2);

    $this->layout = null;
    $this->autoRender = FALSE;  


    // GET THE CONTACTS
    // ------------------------------------------------------------->
    $contacts = $this->Contact->find('all', array('limit' => 20,  'contain' => FALSE));

    $this->loadModel('MailMerge');
    $content = $this->MailMerge->find('first', array(
                                                'conditions' => array('MailMerge.id' => 1),
                                                'fields' => array('MailMerge.description')
                                                ));


    // Get a new instance of TBS with the OpenTBS plug-in
    // ------------------------------------------------------------->
     $otbs = $this->Tbs->getOpenTbs(); 

    // Load the template file
    // ------------------------------------------------------------->
    $otbs->LoadTemplate(APP . DS . WEBROOT_DIR . '/files/data_files/enquiry_letter_sample_redcliffe.docx');

    // Merge data in the template
    // ------------------------------------------------------------->
    $otbs->MergeBlock('r', $contacts);
    $otbs->MergeBlock('content', $content);

    // End the merge and export
    // ------------------------------------------------------------->
    $file_name = 'export.docx';
    $otbs->Show(OPENTBS_DOWNLOAD, $file_name);

}
4

0 に答える 0