Convert Binary Template to Text
Sirs
I am moving databases and have followed your example project for converting
Binary data into ASCII for editing for the new database. The sample you
give with the project works fine.
When I get to the ObjectBinaryToText(lFileStream, lTextStream); line
in my code, I consistently get and E.Read Error when trying to read the
binary data below.
The error always occurs about the Default Printer text.
Any advice as to why would be greatfully appreciated.
Regards
Philip L Jackson
Env. Delphi6 ENT, Report Builder 6.03 Ent Win XP Pro.
Code sample below :-
lsFileName: String;
lFileStream: TFileStream;
lTextStream: TMemoryStream;
begin
Richedit1.Clear;
Richedit1.PlainText := TRUE;
with wwDBRichEdit1 do
begin
lsFileName := 'c:\reports\test4.rtm';
PlainText := True;
selectAll;
Lines.SaveToFile(lsFileName);
lFileStream := TFileStream.Create(lsFileName, fmOpenRead);
lTextStream := TMemoryStream.Create;
try
lFileStream.Position := 0;
ObjectBinaryToText(lFileStream, lTextStream);
lTextStream.Position := 0;
Richedit1.Lines.LoadFromStream(lTextStream);
Richedit1.Lines.SaveToFile('c:\reports\ads test3.rtm');
finally
lFileStream.Free;
lTextStream.Free;
end;
end;// end of with DBRichEdit1 do
Data Sample
TPF0 TppReport ppReport1AutoStopDataPipeline
plJobsheetPrinterSetup.BinNameDefaultPrinterSetup.DocumentNameReportP
rinterSetup.PaperNameA4 210 x 297
mmPrinterSetup.PrinterNameDefaultPrinterSetup.mmMarginBottom?PrinterS
etup.mmMarginLeft?PrinterSetup.mmMarginRight?PrinterSetup.mmMarginTop
?PrinterSetup.mmPaperHeightY?e
Font.Style
fsBoldfsItalicJOBNODataPipeline
plJobsheetFont.CharsetDEFAULT_CHARSET
Font.ColorclBlack Font.NameARIAL Font.Size
Font.Style
ht,.mmPrintPositioname
"Jobsheet.DB"sheet
TableSQLAliasJobsheet
"Contract.DB"
TableAliasContract
TableSQLAliasContract
I am moving databases and have followed your example project for converting
Binary data into ASCII for editing for the new database. The sample you
give with the project works fine.
When I get to the ObjectBinaryToText(lFileStream, lTextStream); line
in my code, I consistently get and E.Read Error when trying to read the
binary data below.
The error always occurs about the Default Printer text.
Any advice as to why would be greatfully appreciated.
Regards
Philip L Jackson
Env. Delphi6 ENT, Report Builder 6.03 Ent Win XP Pro.
Code sample below :-
lsFileName: String;
lFileStream: TFileStream;
lTextStream: TMemoryStream;
begin
Richedit1.Clear;
Richedit1.PlainText := TRUE;
with wwDBRichEdit1 do
begin
lsFileName := 'c:\reports\test4.rtm';
PlainText := True;
selectAll;
Lines.SaveToFile(lsFileName);
lFileStream := TFileStream.Create(lsFileName, fmOpenRead);
lTextStream := TMemoryStream.Create;
try
lFileStream.Position := 0;
ObjectBinaryToText(lFileStream, lTextStream);
lTextStream.Position := 0;
Richedit1.Lines.LoadFromStream(lTextStream);
Richedit1.Lines.SaveToFile('c:\reports\ads test3.rtm');
finally
lFileStream.Free;
lTextStream.Free;
end;
end;// end of with DBRichEdit1 do
Data Sample
TPF0 TppReport ppReport1AutoStopDataPipeline
plJobsheetPrinterSetup.BinNameDefaultPrinterSetup.DocumentNameReportP
rinterSetup.PaperNameA4 210 x 297
mmPrinterSetup.PrinterNameDefaultPrinterSetup.mmMarginBottom?PrinterS
etup.mmMarginLeft?PrinterSetup.mmMarginRight?PrinterSetup.mmMarginTop
?PrinterSetup.mmPaperHeightY?e
Font.Style
fsBoldfsItalicJOBNODataPipeline
plJobsheetFont.CharsetDEFAULT_CHARSET
Font.ColorclBlack Font.NameARIAL Font.Size
Font.Style
ht,.mmPrintPositioname
"Jobsheet.DB"sheet
TableSQLAliasJobsheet
"Contract.DB"
TableAliasContract
TableSQLAliasContract
This discussion has been closed.
Comments
Try adding the following code just under your call to ObjectTextToBinary.
You will need to declair and create a local TWriter object giving the new
TWriter your result stream.
lWriter.Root := nil;
lWriter.WriteListEnd;
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
ObjectTextToBinary command.
Regards
In addition, you might check that you have the proper read/write permissions
set on your file streams when you create them. If you have you destination
stream set to just read (fmOpenWrite) you may also get a read error.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com