Я вынужден поять поднять тему, посколку этот глюк уже мешает правильной работе программы. Теперь при записи более сложных строк он подставляет страные символы которые мешают работе всей html страницы, например вот- 5.gerz {position: absolute ; left: 330px; top: 440px;} или /<input name="MyButton" type="radio" class=gerz>, бред одним слововм. вот код который все это делает.
| Код | library brc;
{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. }
uses SysUtils, Classes; type Trec = record html : array[0..100] of string[255]; //Adders: string[60]; end; var F : file of Trec; Wr : Trec; pos : integer;
{$R *.res} function Save(Name,bg : string) : string;//Èìÿ ôóíêöèè begin AssignFile(F, 'Project\index.html');//Ññûëêà íà îòêðûâàåòìûé ôàéë if not fileExists('Project\index.html') then//åñëè ôàéë begin Rewrite(F); end else begin Reset(F); end; Pos := 0;
Wr.html[0] := '<html>'; Wr.html[1] := '<style>'; Wr.html[10] := '</style>'; Wr.html[11] := '<head>'; Wr.html[20] := '</head>'; Wr.html[21] := '<body bgcolor="#'+bg+'">'; Wr.html[22] := '<title>'+Name+'</title>'; Wr.html[100] := '</html>'; Write(F, Wr); end; function CreateRadioButton(Name,x,y : string) : string;//Èìÿ ôóíêöèè begin AssignFile(F, 'Project\index.html');//Ññûëêà íà îòêðûâàåòìûé ôàéë Reset(F); Wr.html[2] := '.'+Name+' {position: absolute ; left: '+x+'px; top: '+y+'px;}'; Wr.html[23] := '<input name="MyButton" type="radio" class='+Name+'>'; Write(F, Wr); end; exports Save; exports CreateRadioButton; begin end.
|
Две функции по форматированию html кодов... Пробовал разные форматы, одно и тоже... |