Mailinglisten-Archive |
Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------BE8F79A826ED4C71D63701B9
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi Martin, hallo alle anderen!
Erstmal vielen Dank!
Ich habe mal etwas weitergecoded... das Ergebnis als Attachment zusammen
mit einem RTF-File zum testen.
Alles funzt, bis auf eines:
Properties, deren Wert _nach_ einem Leerzeichen+Zeilenumbruch steht,
werden noch nicht erkannt, obwohl in der regex [ \n]+ steht. Warum nur?
Beispiele in dieser Datei:
Anordnung
Dokumentnummer
Kunde
Besten Dank und herzliche Gr=FC=DFe aus G=F6ttingen,
Axel
--
a.tietje_(at)_flynet.de
BTW: Ich suche einen Job im Bereich Internet/Consulting...
wei=DF jemand etwas?
--------------BE8F79A826ED4C71D63701B9
Content-Type: text/html; charset=us-ascii;
name="rtf.phtml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="rtf.phtml"
<TITLE>Cool Tool of the Day!</TITLE>
<PRE>
<?php
$rtf = file ("rtfs/test2.rtf"); // Bitte anpassen
$rtf2 = $rtf;
$pattern = "(\{\\\\propname[ \n]+)"
. "([a-z \\\']+)" // Umlaute werden in RTF-Files maskiert! Es gibt auch Property-Bezeichner mit mehr als einem Wort!
. "(\}\\\\proptype30\{\\\\staticval[ \n]+)"
. "([^}]+)"
. "(\})"
. "(.*)";
$newfile = "";
echo "<pre>";
while ( list( $nr, $line ) = each( $rtf ) ) {
while ( eregi($pattern, $line, $regs) ) {
$property[$regs[2]] = $regs[4];
$line = $regs[6]; /* Rest durchsuchen */
}
}
echo "<hr>Hier die Variablen:<br><br>";
while ( list( $key, $value ) = each( $property ) ) {
echo $key, " = ", $value, "<br>";
}
echo "<hr>";
$rtf = $rtf2;
reset ($rtf);
reset ($property);
while ( list( $nr, $text ) = each( $rtf ) ) {
for( reset($property); $key = key($property); next($property) ) {
$pattern = "(\{\\\\propname[ \n]+)"
. "(" . QuoteMeta($key) . ")"
. "(\}\\\\proptype30\{\\\\staticval[ \n]+)"
. "([^}]+)"
. "(\})"
. "(.*)";
$neu = "";
while ( eregi($pattern, $text, $regs) ) {
$replace = $property[$key]."_NEU";
$neu .= eregi_replace($pattern, "\\1\\2\\3$replace\\5", $text);
$text = $regs[6]; /* Rest durchsuchen */
}
$text = $neu . $text;
}
echo $text;
}
echo "\n\n/\\* \\(c\\) Ramsch + Tietje :-)\\\\x \\*/\n";
?></PRE>
--------------BE8F79A826ED4C71D63701B9
Content-Type: text/rtf; charset=us-ascii;
name="test2.rtf"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="test2.rtf"
{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1031{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}}{\colortbl;\red0\green0\blue0;
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\lang1031\cgrid \snext0 Normal;}{\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\lang1031\kerning28\cgrid
\sbasedon0 \snext0 heading 1;}{\s2\sb240\sa60\keepn\widctlpar\adjustright \b\i\f1\lang1031\cgrid \sbasedon0 \snext0 heading 2;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title TITLE_TAG}{\subject THEME_TAG}{\author AUTHOR_TAG}
{\keywords KEYWORD_TAG}{\doccomm COMMENT_TAG}{\operator Axel Tietje}{\creatim\yr1999\mo3\dy19\hr9\min17}{\revtim\yr1999\mo3\dy19\hr9\min17}{\version2}{\edmins0}{\nofpages1}{\nofwords3}{\nofchars30}{\*\manager MANAGER_TAG}{\*\company COMPANY_TAG}
{\*\category CATEGORY_TAG}{\*\hlinkbase HYPERLINKBASE_TAG}{\nofcharsws30}{\vern89}}{\*\userprops {\propname Ablage}\proptype30{\staticval ABLAGE_TAG}{\propname Abteilung}\proptype30{\staticval ABTEILUNG_TAG}{\propname Anordnung}\proptype30{\staticval
ANORDNUNG_TAG}{\propname Aufzeichnungsdatum}\proptype30{\staticval AUFZEICHUNGSDATUM_TAG}{\propname Bearbeiter}\proptype30{\staticval BEARBEITER_TAG}{\propname Bezug}\proptype30{\staticval BEZUG_TAG}{\propname Dokumentnummer}\proptype30{\staticval
DOKUMENTNUMMER_TAG}{\propname Eigent\'fcmer}\proptype30{\staticval EIGENTUEMER_TAG}{\propname Erhalten von}\proptype30{\staticval ERHALTENVON_TAG}{\propname Erstellt von}\proptype30{\staticval ERSTELLTVON_TAG}{\propname Kunde}\proptype30{\staticval
KUNDE_TAG}{\propname Projekt}\proptype30{\staticval PROJEKT_TAG}{\propname Aufgezeichnet von}\proptype30{\staticval AUFGEZEICHNETVON_TAG}}\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134
\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\hyphcaps0\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}
{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}
{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9
\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s1\sb240\sa60\keepn\widctlpar\outlinelevel0\adjustright \b\f1\fs28\lang1031\kerning28\cgrid {<CONTENT1>
\par }\pard\plain \widctlpar\adjustright \fs20\lang1031\cgrid {
\par }\pard\plain \s2\sb240\sa60\keepn\widctlpar\outlinelevel1\adjustright \b\i\f1\lang1031\cgrid {<CONTENT2>
\par }\pard\plain \widctlpar\adjustright \fs20\lang1031\cgrid {
\par
\par <CONTENT3>
\par }}
--------------BE8F79A826ED4C71D63701B9--
php::bar PHP Wiki - Listenarchive