私はニュースレターをワードで生成し、HTMLをMailChimpにコピーして送信します。
Wordには奇妙で素晴らしい書式のアイデアがありますが、そのほとんどは書式設定が使用されているものと一貫しているため、言葉で見ているとおりです。形状> < V:画像データ>タグ:PHP Preg_replace MS Word画像タグのみ
<td width=640 style='width:480.0pt;border-top:solid #1F497D 1.0pt;mso-border-top-themecolor: text2;border-left:none;border-bottom:solid #1F497D 1.0pt;mso-border-bottom-themecolor: text2;border-right:none;background:#1F497D;mso-background-themecolor:text2; padding:0cm 0cm 0cm 0cm;height:26.6pt'>
<p class=MsoNormal align=center style='text-align:center'><b style='mso-bidi-font-weight:normal'><span style='font-family:"Arial","sans-serif"; mso-ansi-language:EN-NZ;mso-fareast-language:EN-NZ;mso-no-proof:yes'><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="[email protected]@[email protected]@[email protected]@[email protected]@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_i1033" type="#_x0000_t75" style='width:479.25pt;height:112.5pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="22nd%20September%20-%20Take%205...%20Your%205%20minute%20fortnightly%20roundup%20of%20alcohol%20and%20other%20drug%20news%20and%20research%202_files/image001.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img border=0 width=639 height=150 src="22nd%20September%20-%20Take%205...%20Your%205%20minute%20fortnightly%20roundup%20of%20alcohol%20and%20other%20drug%20news%20and%20research%202_files/image025.png"v:shapes="_x0000_i1033"><![endif]></span></b><b style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-family:"Arial","sans-serif"'><o:p></o:p></span></b></p>
</td>
唯一の本当の問題は、MS Wordがsnippitが、それは< img>タグの両方のを追加され、ここで、画像を挿入し、< V方法です私はMSコードのすべてを取り除く場合は、書式設定のすべてを殺す:
$parsed_html = preg_replace('/<!--\[[\s\S]*?\]-->/s', '', $html);
私はより具体的に試してみた:
$parsed_html = preg_replace('/<!--\[if gte vml 1\]*?--><!\[if !vml\]>/s', '', $html);
しかし、これは問題なく動作していますが、もう一度やりすぎます。 より良いHTL(haha)またはより良い一致パターンをエクスポートする方法があるかどうか知っていますか。 http://pastebin.com/myPwnHbd
ここではPHPが(簡単なHTMLフォームからhtmlファイルをアップロードします)これまでのところです: http://pastebin.com/Wc7hEk7c
http://stackoverflow.com/questions/11400260/remove-ms-word-html-using-php – nogad