Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General Discussion » View Thread |
Messages 1 to 5 of 5 total |
Converting DBISAM3 to EDB, TjvDBRichEdit problem. Inicode? |
Thu, Nov 21 2013 10:59 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | Not an EDB problem probably ...
I have converted my DBISAM3 data to EDB. RichEdit data stored in CLOB's appears to have transferred OK. I have looked at the data with EDB Manager and the CLOB look like "{\rtf1\ansi\ansicpg1252\deff0\deflang5129{\fonttbl{\f0\fswiss\fprq2\" etc. as expected. But when I view the data in my program - in a TjvDBRichEdit - all I get is gobble-de-gook. I'm guessing it is because I choose to go the Unicode way and somehow I have to tell the richedit component that it is unicode. Any ideas - Googling around suggests no one else has the same problem, so I might be doing something uniquely stupid Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz |
Fri, Nov 22 2013 3:48 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Jeff
Without seeing the rest of the CLOB contents what you show is not unicode so your problem may be exactly the opposite to what you think. I've never used TjvDBRichEdit (I use WPTools and avoid jedi like the plague) so I don't know how things work with it. Quick way to see what's going on is a small test app with your table and the non DB aware version of the control. Try loading your rtf in directly and see what happens. Roy Lambert |
Sun, Nov 24 2013 11:41 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz "Roy Lambert" <roy@lybster.me.uk> wrote in message news:93AEA615-14AE-46C4-B4E5-16335700ECD1@news.elevatesoft.com... > Jeff > > > Without seeing the rest of the CLOB contents what you show is not unicode > *!!!! HOW CAN YOU TELL ???) so your problem may be exactly the opposite > to what you think. > > I've never used TjvDBRichEdit (I use WPTools and avoid jedi like the > plague) so I don't know how things work with it. Quick way to see what's > going on is a small test app with your table and the non DB aware version > of the control. Try loading your rtf in directly and see what happens. > > Roy Lambert > Hi Roy and all After most of a day wasted on this, this is where I am with this. Firstly, it is not a JEDI problem as I have the same problem with standard Delphi controls. WHERE I STARTED 1. Database migrated from DBISAM3 to EDB Unicode. 2. Some tables have CLOB fields that contain data captured from RichEdits. 3. Using the Unicode version EDB manager I can look at the CLOBs and they look like normal RTF format As suggested by Roy, I wrote a simple demo app, without using any JCL - thus avoiding Roy's plague of Jedis. WHAT WORKS IN TEST APP 1. Hooked a grid and TDBRichEdit up to the table and I can scroll through the table and the TDBRichEdit displays the text as expected with bold/underlines/bullets/font changes etc. WHAT DOESN'T WORK 1. Loading the edit manually like I would in DBISAM3 doesn't work. procedure TForm1.tblLettersAfterScroll(DataSet: TDataSet); begin str.Clear; tblLettersLetterText.SaveToStream(str); str.Position := 0; RichEdit1.Lines.LoadFromStream(str); end; ... saving the richtext to a memory steam and then loading it into the richedit results in garbage displayed. 2. Loading via a file doesn't work. procedure TForm1.tblLettersAfterScroll(DataSet: TDataSet); begin tblLettersLetterText.SaveToFile('c:\temp\jeff.rtf'); RichEdit1.Lines.LoadFromFile('c:\temp\jeff.rtf'); end; ... the same sort of garbage - the file contents are as below my signature. So standard VCL components - data aware works but loading a non data aware doesn't Conclusion is that my code :- -------------------------------------- str.Clear; tblLettersLetterText.SaveToStream(str); str.Position := 0; RichEdit1.Lines.LoadFromStream(str); ------------------------------------ is at fault. It worked with Delphi7 and DBISAM3, but doesn't work with Delphi XE and EDB 2.14 Build 2 -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz The contents of the "jeff.rtf" file -- looks normal to my untrained eye, but WordPad does like it, so I opened it in NotePad ------------------------------------------------------------------------------------------------------------------------------------- {\rtf1\ansi\ansicpg1252\deff0\deflang5129{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\cf1\lang2057\f0\fs22\{Landlord|AddressTo\}\par \{Landlord|AddressLine1\}\par \{Landlord|AddressLine2\}\par \{Landlord|AddressLine3\}\par \par \{Other|LetterDate\}\par \par Dear \{Landlord|ContactName\}\par \par Re:\par \par \{Other|LetterDate-10\} to \{Other|LetterDate+10\}\par \par \{Tenant|AddressTo\}\par \par \par Yours sincerely,\par \par \par ________________________\par \{Property Manager|Name\}\par \{Property Manager|Position\}\par } ------------------------------------------------------------------------------------------------------------------------------------- |
Sun, Nov 24 2013 11:50 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | "Jeff Cook" <jeffc@aspect.co.nz> wrote in message
news:414825F8-DE4D-4FA8-B89A-14AC364FBB59@news.elevatesoft.com... > > So standard VCL components - data aware works but loading a non data aware > doesn't > > Conclusion is that my code :- > > -------------------------------------- > str.Clear; > tblLettersLetterText.SaveToStream(str); > str.Position := 0; > RichEdit1.Lines.LoadFromStream(str); > ------------------------------------ > > is at fault. It worked with Delphi7 and DBISAM3, but doesn't work with > Delphi XE and EDB 2.14 Build 2 > ALTERNATIVE CONCLUSION !!!! TDBRichEdit knows that is dealing with Unicode because its connection to a Unicode database somehow tells it. Question:- How do I tell TRichEdit that it is dealing with Unicode? -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz |
Mon, Nov 25 2013 10:40 PM | Permanent Link |
Jeff Cook Aspect Systems Ltd | "Jeff Cook" <jeffc@aspect.co.nz> wrote in message
news:029984E1-CF0F-486F-94EE-987763BD0A8F@news.elevatesoft.com... > "Jeff Cook" <jeffc@aspect.co.nz> wrote in message > news:414825F8-DE4D-4FA8-B89A-14AC364FBB59@news.elevatesoft.com... >> >> So standard VCL components - data aware works but loading a non data >> aware doesn't >> >> Conclusion is that my code :- >> >> -------------------------------------- >> str.Clear; >> tblLettersLetterText.SaveToStream(str); >> str.Position := 0; >> RichEdit1.Lines.LoadFromStream(str); >> ------------------------------------ >> >> is at fault. It worked with Delphi7 and DBISAM3, but doesn't work with >> Delphi XE and EDB 2.14 Build 2 >> Yes! My code is wrong (surprise!) I now understand what has happened. The RichText was in a DBISAM3 BLOB and is now in and EDB CLOB. The Migrator has transferred the contents of the file correctly including the BLOB/CLOB and it has left the contents of the xLOB alone - as it should. But the way I move the data to TRichEdit or TjvRichEdit is corrupting the data. This works (str is a TMemoryStream) :- procedure TForm1.tblLettersAfterScroll(DataSet: TDataSet); var rtfString: AnsiString; begin rtfString := tblLettersLetterText.AsAnsiString; str.Clear; str.Write(PAnsiChar(rtfString)^, Length(rtfString)); str.Position := 0; RichEdit1.Lines.LoadFromStream(str); // OK for VCL str.Position := 0; jvRichEdit1.Lines.LoadFromStream(str); // and OK for the JEDI end; I have 151 matches in 38 modules for "RichEdit", but now I can whip through those, fix as required and move onto the next hitch in my conversion. Obviously I'll have to come back and address this whole area, but the current objective is to get my DBISAM3/Delphi7 product upgraded to EDB/DelphiXE, with everything working the same (from a user point of view). I'll follow up Roy's suggestion of WPTools as what I'm doing now is a little clunky, though it has worked well up to now. Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz .. |
This web page was last updated on Monday, May 6, 2024 at 01:09 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |