15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Non-RTF input

Ken Miller -- kmiller@ccse.net
Saturday, October 05, 1996

Environment: Win95, VC4.0

I am working on a program that is to read in an ASCII file and output a RTF
file.  I am using CRichEditDoc and View.  Unfortunately, the way it is now,
it only reads RTF files.  I have tried to open regular non-RTF files and it
will open a new window, but it'll be empty.  I checked the number of lines
read and it was only 1, even though there were a lot more in the file.  How
do you change it to allow reading of non-RTF files.

Ken



Sanjay Chouksey -- sanjay@mediaway.com
Monday, October 07, 1996

[Mini-digest: 2 responses]

Hi Ken,

The CRichEditView will read only RTF files, from the
CRichEditDoc::Serialize() method.
You need to directly do the loading yourselft if you want to read the ASCII
file. Change the
app wizard generated code from:

if (ar.IsStoring())
{
	// TODO: add storing code here
}
else
{
	// TODO: add loading code here
}
// Calling the base class CRichEditDoc enables serialization
//  of the container document's COleClientItem objects.
CRichEditDoc::Serialize(ar);

To:

if (ar.IsStoring())
{
	CRichEditDoc::Serialize(ar);
}
else
{
	// do the following:
	// look at CRichEditCtrl::StreamIn function
	// to read from a stream, (it calls a callback for data, open a file in
the
	// callback and read from it)
	// with the nFormat parameter of StreamIn to SF_TEXT
}


----------
> From: Ken Miller 
> To: mfc-l@netcom.com
> Subject: Non-RTF input
> Date: Saturday, October 05, 1996 2:06 PM
> 
> Environment: Win95, VC4.0
> 
> I am working on a program that is to read in an ASCII file and output a
RTF
> file.  I am using CRichEditDoc and View.  Unfortunately, the way it is
now,
> it only reads RTF files.  I have tried to open regular non-RTF files and
it
> will open a new window, but it'll be empty.  I checked the number of
lines
> read and it was only 1, even though there were a lot more in the file. 
How
> do you change it to allow reading of non-RTF files.
> 
> Ken

-Sanjay

-----From: pjn@indigo.ie (pjn)

You need to set CRIchEditDoc::m_bRTF to FALSE prior to loading as it
is expecting to load an RTF file.


                             '''	  =20
                             @ @
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
ooO-(_)-Ooo=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+
|                                           PJ Naughter              |
|                                                                    |
| Software Developer                   Email: pjn@indigo.ie          |
| Softech Telecom                      Tel:   +353-1-2958384         |
|                                      Fax:   +353-1-2956290         |
| Author of DTime - A Collection       URL:   http://indigo.ie/~pjn  |
| of Date & Time classes for MFC                                     |
|                                                                    |
|                  Addr: 7 Woodford, Brewery Road, Stillorgan,       |
|                        Blackrock, Co. Dublin, Republic of Ireland  |
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+




| Вернуться в корень Архива |