Board index » cppbuilder » Re: Richedit and Text file.
Hans Galema
![]() CBuilder Developer |
Hans Galema
![]() CBuilder Developer |
Re: Richedit and Text file.2005-06-01 12:31:52 AM cppbuilder81 Dwayne wrote: QuoteI am loading up a Text file in RichEdit. The only problem is, the file in the rich text format.(*.rtf). Hans. |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-06-01 12:45:13 AM
Re:Re: Richedit and Text file.
"Dwayne" < XXXX@XXXXX.COM >wrote in message
QuoteI am loading up a Text file in RichEdit. to loading? Gambit |
Dwayne
![]() CBuilder Developer |
2005-06-01 04:39:45 AM
Re:Re: Richedit and Text file.
Hello Folks,
I am loading up a Text file in RichEdit. The only problem is, the file in the window has all the "Formatting" destroyed. It is a pure Text file, and if I look at it with a text editor, it is perfect. If I load it up with Richedit, the Spaces between the words are destroyed. I have tried changing the pitches from Normal, to Fixed, to Variable. No luck... Any suggestions? Dwayne {smallsort} |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-06-01 06:28:41 AM
Re:Re: Richedit and Text file.
"Dwayne" < XXXX@XXXXX.COM >wrote in message
QuoteI am creating the Text file with the following: data arrays are containing. QuotePlain Text can be either true or false... I get the same result. QuoteI uploaded a attachment. |
Dwayne
![]() CBuilder Developer |
2005-06-01 09:40:20 AM
Re:Re: Richedit and Text file.
Hello Gambit,
Gambit>>How exactly are you loding the text? If via the RichEdit's LoadFromStream() Quoteor LoadFromFile() methods, what is the value of the PlainText property I am creating the Text file with the following: FILE *out; out=fopen("data.bak","wt"); sprintf(buf,"%9s%9s%9s%9s%9.0f%9.0f %8.2f %8.2f\n", Dat[(int)a],Cus[(int)a],Ord[(int)a],Inv[(int)a], Amo[(int)a],totalboardfeet-Amo[(int)a], Cos[(int)a],Total-Cos[(int)a]); fputs(buf,out); The "\n" is the only "new line" hidden character for ASCII. I Loop through the sprintf command a certain number of times (between 1 and 100 or so, dependin on requirements). Then I close the file and do the following: Form3->RichEdit1->Lines->LoadFromFile("Data.bak"); Plain Text can be either true or false... I get the same result. I uploaded a attachment. Dwayne |
Pete Fraser
![]() CBuilder Developer |
2005-06-01 10:28:10 PM
Re:Re: Richedit and Text file.
You might want to set a non-proportional font (like courier) which will make
columns align correctly. Propotional spaced fonts like Times etc. make spaces quite narrow and so columns dont line up. HTH Pete BTW you are NOT supposed to upload files to these newsgroups. The binaries newsgroup is where these should be placed. "Dwayne" < XXXX@XXXXX.COM >wrote in message QuoteI took a look at my upload, and the outcome of the RichEdit turned out ok, |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-06-02 01:26:39 AM
Re:Re: Richedit and Text file.
"Dwayne" < XXXX@XXXXX.COM >wrote in message
QuoteI believe the RichEdit is losing the "Spaces or Justificatin QuoteIt seems they do not allow any uploads to this news group. Quotecopy/paste produces this: doesn't work for you, then something else in your project has to be at fault. What font settings are you using specifically in the RichEdit? Gambit |
Dwayne
![]() CBuilder Developer |
2005-06-02 02:20:29 AM
Re:Re: Richedit and Text file.
Hello Gambit,
QuoteRather than showing the code that producing the text file, why don't you with, so Quotewhat formatting do you think the RichEdit is losing exactly? sprintf(buf,"%9s%9s%9s%9s%9.0f%9.0f %8.2f %8.2f\n",...Because the data being saved to the file is perfect, justified, and is exactly what is needed. Gambit>>I uploaded a attachment. I see no such attachment. Where you did you upload it?<< Please accept my apologies... It seems they do not allow any uploads to this news group. I sent the message with a text attachment to show the exact data, but I kept receiving "group does not allow attachment errors" when attempting to upload with attachment. I will do a copy paste with the data here, but I never have much luck with formatting correctly on these forums. copy/paste produces this: (which is all correct data, but skewed from the original file). NotePad opens it up perfectly, along with all the editors I have used so far... 08122003 PLUM CR 5-2551 2551 112242 112242 35020.63 35020.63 09022003 LAWRENC 5-2620 164804 3591 108651 1120.43 33900.20 09152003 STOCK 5-2644 165153 17388 91263 5425.23 28474.97 10022003 BIG D 5-2657 165847 8505 82758 2653.65 25821.32 10302003 BIG D L 5-2683 166628 7560 75198 2358.80 23462.53 11032003 BIG D 5-2690 166665 8505 66693 2653.65 20808.88 11122003 BIG D 5-2691 166960 6804 59889 2122.92 18685.97 11192003 BMCW 5-2699 167163 18711 41178 5838.02 12847.95 11192003 BMCW 5-2700 167164 24168 17010 7540.66 5307.29 12092003 BIG D 5-2710 167597 11340 5670 3538.19 1769.10 01152004 FRISCO 5-2749 168281 5670 0 1769.10 0.00 This is how it looks in Notepad (I am hoping this will save and upload properly, everything is right justified, thus making even columns on the right side.) 08122003 PLUM CR 5-2551 2551 112242 112242 35020.63 35020.63 09022003 LAWRENC 5-2620 164804 3591 108651 1120.43 33900.20 09152003 STOCK 5-2644 165153 17388 91263 5425.23 28474.97 10022003 BIG D 5-2657 165847 8505 82758 2653.65 25821.32 10302003 BIG D L 5-2683 166628 7560 75198 2358.80 23462.53 11032003 BIG D 5-2690 166665 8505 66693 2653.65 20808.88 11122003 BIG D 5-2691 166960 6804 59889 2122.92 18685.97 11192003 BMCW 5-2699 167163 18711 41178 5838.02 12847.95 11192003 BMCW 5-2700 167164 24168 17010 7540.66 5307.29 12092003 BIG D 5-2710 167597 11340 5670 3538.19 1769.10 01152004 FRISCO 5-2749 168281 5670 0 1769.10 0.00 Dwayne |
Dwayne
![]() CBuilder Developer |
2005-06-02 02:26:01 AM
Re:Re: Richedit and Text file.
I believe I got the file to upload on my other try...
It is attached to my other message.. the filename is Data.bak. simple ASCII. Sorry for my errors. Dwayne |
Dwayne
![]() CBuilder Developer |
2005-06-02 04:10:55 AM
Re:Re: Richedit and Text file.
Hello Pete, Gambit, and others,
Pete>You might want to set a non-proportional font (like courier) which will make Quotecolumns align correctly. Thank you all for your help, patience, and time. Dwayne |