欢迎光临第一亲子网

将RTF格式的文件转成HTML并在网页中显示的代码(3)

2013-9-3 | 来源:第一亲子网 | 点击:

导读: quot;"; 牋牋} 牋牋// Replace ab with alternating spaces牋 牋牋//牋牋燼nd nonbreakingwhitespaces. 牋牋if(ereg("\(tab)", $tags)) { $html .= "牋牋牋牋"; } 牋牋return $html; 牋牋} 牋牋function ProcessWord($word) { 牋牋// Replace \ with 牋...

quot;";
牋牋}
牋牋// Replace ab with alternating spaces牋
牋牋//牋牋燼nd nonbreakingwhitespaces.
牋牋if(ereg("\(tab)", $tags)) { $html .= "牋牋牋牋"; }
牋牋return $html;
牋牋}
牋牋function ProcessWord($word) {
牋牋// Replace \ with
牋牋$word = ereg_replace("[\]{2,}", "\", $word);
牋牋// Replace { with {
牋牋$word = ereg_replace("[\][{]", "{", $word);
牋牋// Replace } with }
牋牋$word = ereg_replace("[\][}]", "}", $word);
牋牋// Replace 2 spaces with one space.
牋牋$word = ereg_replace(" ", "牋", $word);
牋牋return $word;
牋牋}
牋牋$color = "000000";
牋牋$size = 1;
牋牋$bullets = 0;
牋牋// Read the uploaded file into an array.
牋牋//牋牋牋
牋牋$rtfile = file($userfile);
牋牋$fileLength = count($rtfile);
牋牋// Loop through the rest of the array
牋牋for($i = 1; $i < $fileLength; $i++) {
牋牋/*
牋牋** If the line contains "colortbl" then we found the color table.
牋牋** We'll have to split it up into each individual red, green, and blue
牋牋** Convert it to hex and then put the red, green, and blue back together.
牋牋** Then store each into an array called fcolor.
牋牋*/
牋牋if(ereg("^{\colortbl", $rtfile[$i])) {
牋牋// Split the line by the backslash.
牋牋$colors = explode("\", $rtfile[$i]);
牋牋$numOfColors = count($colors);
牋牋for($k = 2; $k < $numOfColors; $k++) {
牋牋// Find out how many different colors th
牋牋//牋牋爀re are.
牋牋if(ereg("[0-9]+", $colors[$k], $matches)) {
牋牋$match[] = $matches[0];
牋牋}
牋牋}
牋牋
牋牋// For each color, convert it to hex.
&n

上一页12345下一页

上一篇:将RTF格式的文件转成HTML并在网页

下一篇:将RTF格式的文件转成HTML并在网页