Как перевести RTF в HTML?
Здесь процедура, которую я использую для конвертации содержимого RichEdit в код SGML. Она не создает полноценный HTML-файл, но Вы можете расширить функциональность, указал, какие RTF-коды Вы желаете конвертировать в какие-либо HTML-тэги.
function rtf2sgml (text : string) : string; {Funktion for att konvertera en RTF-rad till SGML-text.} var temptext : string; start : integer; begin text := stringreplaceall (text,'&','##amp;'); text := stringreplaceall (text,'##amp','&'); text := stringreplaceall (text,'\'+chr(39)+'e5','a'); text := stringreplaceall (text,'\'+chr(39)+'c5','A'); text := stringreplaceall (text,'\'+chr(39)+'e4','a'); text := stringreplaceall (text,'\'+chr(39)+'c4','A'); text := stringreplaceall (text,'\'+chr(39)+'f6','o'); text := stringreplaceall (text,'\'+chr(39)+'d6','O'); text := stringreplaceall (text,'\'+chr(39)+'e9','e'); text := stringreplaceall (text,'\'+chr(39)+'c9','E!
'); text := stringreplaceall (text,'\'+chr(39)+'e1','a'); text := stringreplaceall (text,'\'+chr(39)+'c1','A'); text := stringreplaceall (text,'\'+chr(39)+'e0','a'); text := stringreplaceall (text,'\'+chr(39)+'c0','A'); text := stringreplaceall (text,'\'+chr(39)+'f2','o'); text := stringreplaceall (text,'\'+chr(39)+'d2','O'); text := stringreplaceall (text,'\'+chr(39)+'fc','u'); text := stringreplaceall (text,'\'+chr(39)+'dc','U'); text := stringreplaceall (text,'\'+chr(39)+'a3','?'); text := stringreplaceall (text,'\}','#]#'); text := stringreplaceall (text,'\{','#[#'); text := stringreplaceall (text,'{\rtf1\ansi\deff0\deftab720','');{Skall alltid tas bort} text := stringreplaceall (text,'{\fonttbl',''); {Skall alltid tas bort} text := stringreplaceall (text,'{\f0\fnil MS Sans Serif;}','');{Skall alltid tas bort} text := stringreplaceall (text,'{\f1\fnil\fcharset2 Symbol;}','');{Skall alltid tas bort} text := stringreplaceall !
(text,'{\f2\fswiss\fprq2 System;}}','');{Skall alltid tas bort} text := stringreplaceall (text,'{\colortbl\red0\green0\blue0;}','');{Skall alltid tas bort} {I version 2.01 av Delphi finns inte \cf0 med i RTF-rutan. Tog darfor bort det efter \fs16 och la istallet en egen tvatt av \cf0.} //temptext := hamtastreng (text,'{\rtf1','\deflang'); //text := stringreplace (text,temptext,''); {Hamta och radera allt fran start till deflang} text := stringreplaceall (text,'\cf0',''); temptext := hamtastreng (text,'\deflang','\pard');{Plocka fran deflang till pard for att fa } text := stringreplace (text,temptext,'');{oavsett vilken lang det ar. Norska o svenska ar olika} {Har skall vi plocka bort fs och flera olika siffror beroende pa vilka alternativ vi godkanner.} //text := stringreplaceall (text,'\fs16','');{8 punkter} //text := stringreplaceall (text,'\fs20','');{10 punkter} {Nu stadar vi istallet bort alla tvasif!
friga fontsize.} while pos ('\fs',text) >0 do begin application.processmessages; start := pos ('\fs',text); Delete(text,start,5); end; text := stringreplaceall (text,'\pard\plain\f0 ','<P>'); text := stringreplaceall (text,'\par \plain\f0\b\ul ','</P><MELLIS>'); text := stringreplaceall (text,'\plain\f0\b\ul ','</P><MELLIS>'); text := stringreplaceall (text,'\plain\f0','</MELLIS>'); text := stringreplaceall (text,'\par }','</P>'); text := stringreplaceall (text,'\par ','</P><P>'); text := stringreplaceall (text,'#]#','}'); text := stringreplaceall (text,'#[#','{'); text := stringreplaceall (text,'\\','\'); result := text; end;
//This is cut directly from the middle of a fairly long save routine that calls the above function. //I know I could use streams instead of going through a separate fil!
e but I have not had the time to change this
Защита программ и данных с использованием электронных ключей. Часть 1 Введение.
Данный обзор не претендует на правдоподобность так как я (по мнению некоторых) совершенно не разбираюсь в этой теме. Это всего лишь жалкая попытка рассказать то, что я знаю сам. Как же я пришел к выводу об необходимости использования электронных ключей???
Давно витающая в воздухе нашего сайта идея создания журнала, посвященного всеми нами любимой среде разработки Delphi, похоже, обретает зримую форму. Несомненно, ваше мнение о необходимости такого журнала, содержании рубрик и темах отдельных статей поможет сделать журнал более полезным и интересным. Высказать свое мнение, проголосовать или же подписаться вы можете на сайте. Без вашего участия, нам будет трудно сделать правильный журнал!
Для души
Хокку дня
Котенок пытается лакать Сплошное молоко Первого в жизни снега.
Афоризмы
И ностальгия уже не та, что была раньше (Симона Синьоре)
Фраза дня
Жизнь как телеграмма, - короткая и с ошибками.
И на закуску коротенький анекдот
- Доктор, у меня голова кружится... - Я вижу.