Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

megsoft

[RESOLVIDO] Exibir o conteudo de campo blob em HTML

Recommended Posts

Caros Colegas,Estou tentando exibir o conteudo de um campo do tipo Blob (Interbase). mas é mostrado o seguinte codigo abaixo:{rtf1ansiansicpg1252deff0deflang1046{fonttbl{f0fswissfprq2fcharset0 Arial;}{f1fnilfcharset0 MS Sans Serif;}}viewkind4uc1pardli3969qjlang1024bf0fs24parparLEI N'ba 1.401/2007parparparD'c1 A ATUAL RUA ldblquote Drdblquote , DO LOTEAMENTO TERRA DO REMANSO - BAIRRO BATEIAS A DENOMINA'c7'c3O DE RUAAUX'caNCIO DIAS DE OLIVEIRA.parpardnowidctlparli4536sl-272slmult0qjtx4536lang2070parparpardnowidctlparli504sl-272slmult0qjtx504b0parparpardnowidctlparfi1701sl-272slmult0qjtx0b O Prefeito Municipal de Vit'f3ria da Conquista, Estado da Bahia,parb0parparFa'e7o saber que a C'e2mara Municipal de Vereadores aprovou e eu sanciono a seguinte Lei: parparparpardfi1701qjlang1024b Art. 1'bai i0 -b0 Passa a Rua ldblquote Drdblquote , Loteamento Terra do Remanso - Bairro Bateias, a denominar-se b RuaAux'eancio Dias de Oliveirab0 .parpardnowidctlparfi1701sl-272slmult0qjtx0lang1046parlang2070parpardfi1701qjlang1024b Art. 2'bab0 Esta lei entrar'e1 em vigor na data de sua publica'e7'e3o, revogadas as disposi'e7'f5es em contr'e1rio.parparparpardnowidctlparfi1701sl-272slmult0qjtx0tx204lang2070parGabinete do Prefeito Municipal de Vit'f3ria da Conquista, 15 de maio de 2007.parpardnowidctlparli567sl-272slmult0qjtx204parഊparparparpardnowidctlparsl-272slmult0qctx204b Jos'e9 Raimundo FontesparPrefeitob0parpardlang1046f1fs20par}Podemos observar que os acentos, tamanho e tipos de fontes não são mostrados.Se alguém puder me ajudar ficarei eternamente grato.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Caros Colegas,Eu já conseguir salvar em formato *.RTF e fica todo formatado mas o problema é que quando eu importo para Html ou pdf. o texto fica desformatado novamente.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá pessoal conseguir resolver meu problema.

Eis o código:

 

$sTexto = BLOB;$rtfile = split("\pard", $sTexto);$fileLength = count($rtfile);for($i = 1; $i < $fileLength; $i++){   $rtfile[$i] = $rtfile[$i] . "\n";}for($i = 1; $i < $fileLength; $i++){   $rtfile[$i] = replace_acentos($rtfile[$i]);   if(ereg("^\{\\\colortbl", $rtfile[$i]))   {	  $colors = explode("\\", $rtfile[$i]);	  $numOfColors = count($colors);	  for($k = 2; $k < $numOfColors; $k++)	  {		 if(ereg("[0-9]+", $colors[$k], $matches))		 {			$match[] = $matches[0];		 }	  }	  $numOfColors = count($match);	  for($k = 0; $k < $numOfColors; $k += 3)	  {		 $red = dechex($match[$k]);		 $red = $match[$k] < 16 ? "0$red": $red;		 $green = dechex($match[$k + 1]);		 $green = $match[$k + 1] < 16 ? "0$green": $green;		 $blue = dechex($match[$k + 2]);		 $blue = $match[$k + 2] < 16 ? "0$blue": $blue;		 $fcolor[] = "$red$green$blue";	  }	  $numOfColors = count($fcolor);   }   else   {	  $token = "";	  $start = 0;	  $lineLength = strlen($rtfile[$i]);	  for($k = 0; $k < $lineLength; $k++)	  {		 if($rtfile[$i][$start] == "\\" && $rtfile[$i][$start + 1] != "\\")		 {			$token .= $rtfile[$i][$k];			if($rtfile[$i][$k] == " ")			{			   $newFile[$i] .= ProcessTags($token, $i);			   $token = "";			   $start = $k + 1;			}			elseif($rtfile[$i][$k] == "\n")			{			   $newFile[$i] .= ProcessTags($token, $i);			   $token = "";			}		 }		 elseif($rtfile[$i][$start] == "{")		 {			$token .= $rtfile[$i][$k];			if($rtfile[$i][$k] == "}")			{			   $newFile[$i] .= ProcessTags($token, $i);			   $token = "";			   $start = $k + 1;			}		 }		 else		 {			if($rtfile[$i][$k] == "\\" && $rtfile[$i][$k + 1] != "\\" && $rtfile[$i][$k - 1] != "\\")			{			   $newFile[$i] .= ProcessWord($token);			   $token = $rtfile[$i][$k];			   $start = $k;			}			else			{			   $token .= $rtfile[$i][$k];			}		 }	  }   }}$limit = sizeof($newFile);for($i = 0; $i < $limit; $i++){   $dados = $dados . $newFile[$i];}$pdf = new PDF();$pdf->SetFont('Arial', '', 8);$pdf->AddPage();$pdf->SetCreator("HTML2PDF");$pdf->SetFont('Arial', '', 8);$pdf->WriteHTML($dados);header('Content-Type: application/pdf');$pdf->Output($sArquivo, "F");header("Location:" . $sArquivo);function ProcessTags($tags, $line){$html = "";global $color;global $size;global $bullets;$tags = trim($tags);if(ereg("\\\pnindent", $tags)){   $html .= "<ul><li>";   $bullets += $line;   $tags = ereg_replace("\\\par", "", $tags);   $tags = ereg_replace("\\\(tab)", "", $tags);}if($line - $bullets == 0){   $tags = ereg_replace("\\\par", "", $tags);}elseif($line - $bullets == 1){   if(ereg("\\\pntext", $tags))   {	  $html .= "<li>";	  $tags = ereg_replace("\\\par", "", $tags);	  $tags = ereg_replace("\\\(tab)", "", $tags);	  $bullets++;   }   else   {	  $html .= "</ul>";	  $bullets = 0;   }}if(ereg("\\\b0", $tags)){   $html .= "</b>";}elseif(ereg("\\\b", $tags)){   $html .= "<b>";}if(ereg("\\\i0", $tags)){   $html .= "</i>";}elseif(ereg("\\\i", $tags)){   $html .= "<i>";}if(ereg("\\\ulnone", $tags)){   $html .= "</u>";}elseif(ereg("\\\ul", $tags)){   $html .= "<u>";}if(ereg("\\\pard\\\qc", $tags)){   $html .= "<div align=center>";}elseif(ereg("\\\pard\\\qr", $tags)){   $html .= "<div align=right>";}elseif(ereg("\\\pard", $tags)){   $html .= "<div align=left>";}$tags = ereg_replace("\\\pard", "", $tags);if(ereg("\\\par", $tags)){   $html .= "<br>";}if(ereg("\\\cf[0-9]", $tags)){   global $fcolor;   $numcolors = count($fcolor);   for($i = 0; $i < $numcolors; $i++)   {	  $test = "\\\cf" . ($i + 1);	  if(ereg($test, $tags))	  {		 $color = $fcolor[$i];	  }   }}if(ereg("\\\fs[0-9][0-9]", $tags, $temp)){   $size = ereg_replace("\\\fs", "", $temp[0]);   $size /= 2;   if ($size <= 10)   {	  $size = 1;   }   elseif($size <= 12)   {	  $size = 2;   }   elseif($size <= 14)   {	  $size = 3;   }   elseif($size <= 16)   {	  $size = 4;   }   elseif($size <= 18)   {	  $size = 5;   }   elseif($size <= 20)   {	  $size = 6;   }   elseif($size <= 22)   {	  $size = 7;   }   else   {	  $size = 8;   }}if(ereg("\\\(tab)", $tags)){   $html .= "        ";}return $html;}function ProcessWord($word){$word = ereg_replace("[\\]{2,}", "\\", $word);$word = ereg_replace("[\\][\{]", "\{", $word);$word = ereg_replace("[\\][\}]", "\}", $word);$word = ereg_replace("  ", "  ", $word);return $word;}function replace_acentos($dado){$dado = str_replace("\'c0", "À", $dado);$dado = str_replace("\'c1", "Á", $dado);$dado = str_replace("\'c2", "Â", $dado);$dado = str_replace("\'c3", "Ã", $dado);$dado = str_replace("\'c4", "Ä", $dado);$dado = str_replace("\'c9", "É", $dado);$dado = str_replace("\'d4", "Ô", $dado);$dado = str_replace("\'d2", "Ò", $dado);$dado = str_replace("\'d3", "Ó", $dado);$dado = str_replace("\'d5", "Õ", $dado);$dado = str_replace("\'d6", "Ö", $dado);$dado = str_replace("\'c7", "Ç", $dado);$dado = str_replace("\'e7", "ç", $dado);$dado = str_replace("\'e0", "à", $dado);$dado = str_replace("\'e1", "á", $dado);$dado = str_replace("\'e2", "â", $dado);$dado = str_replace("\'e3", "ã", $dado);$dado = str_replace("\'e4", "ä", $dado);$dado = str_replace("\'e9", "é", $dado);$dado = str_replace("\'f2", "ò", $dado);$dado = str_replace("\'f3", "ó", $dado);$dado = str_replace("\'f4", "ô", $dado);$dado = str_replace("\'f5", "õ", $dado);$dado = str_replace("\'f6", "ö", $dado);$dado = str_replace("\'eb", "ë", $dado);$dado = str_replace("\'ec", "ì", $dado);$dado = str_replace("\'ed", "í", $dado);$dado = str_replace("\'ef", "ï", $dado);$dado = str_replace("\'ee", "ê", $dado);$dado = str_replace("\'cc", "Ì", $dado);$dado = str_replace("\'cd", "Í", $dado);$dado = str_replace("\'ce", "Î", $dado);$dado = str_replace("\'cf", "Ï", $dado);$dado = str_replace("\'ca", "Ê", $dado);$dado = str_replace("\'cb", "Ë", $dado);$dado = str_replace("\'ea", "ê", $dado);$dado = str_replace("\'fa", "ú", $dado);$dado = str_replace("\'fb", "û", $dado);$dado = str_replace("\'fc", "ü", $dado);$dado = str_replace("\'f9", "ù", $dado);$dado = str_replace("\'da", "Ú", $dado);$dado = str_replace("\'db", "Û", $dado);$dado = str_replace("\'dc", "Ü", $dado);$dado = str_replace("\'d9", "Ù", $dado);$dado = str_replace("\'ba", "º", $dado);$dado = str_replace("\'aa", "ª", $dado);return $dado;}

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.