Serializing and font problems...
------
I've created simple text editor SDI Application, base View class is: CRichEditView.
I want to serialize it as simple text, without RTF stuff, and save it with ASM file
extension, so i changed m_bRTF to FALSE, everything works....but:
when i create document, type something there, save it, and try to open with MS Notepad
Application, i see one space before my text!!! why is it so?
for example, in my application i type word:test, and save it to asm2.asm
everything ok...but when i open this file with Notepad, i see: test,
there is one space before the "test" word! why? how to fix it??
Problem number 2:
------
In the same Application i want to use font "Courier New" with yHeight parameter = 200,
ONLY! Not any other font and size! So...i made the following:
CRich5View.cpp
void CRich5View::OnInitialUpdate()
{
CRichEditView::OnInitialUpdate();
// Set the printing margins (720 twips = 1/2 inch)
SetMargins(CRect(720, 720, 720, 720));
// I WANT TO USE ONLY THIS FONT
CHARFORMAT2 cf;
cf.dwMask = CFM_COLOR | CFM_FACE | CFM_BOLD | CFM_SIZE;
cf.dwEffects = CFM_FACE;
cf.yHeight = 200;
cf.crTextColor = RGB(0,0,0);
strcpy(cf.szFaceName,"Courier New");
SetCharFormat (cf);
CRich5Doc* pDoc = GetDocument(); // getting document.
CRichEditView::GetWindowText(pDoc->m_strText); // Storing text to m_strText
}
When i save/open/edit *.ASM files, font is this one... But when i try to open
another...for example *.TXT file, font changes!!! How to make it not to change? and always
be like this one??
Here are some parts of another main code:
CRich5Doc.cpp
CRich5Doc::CRich5Doc()
{
m_bRTF = FALSE; // This is done for standard text formatting.
}
CRich5Doc.cpp
void CRich5Doc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
ar << m_strText;
}
else
{
// TODO: add loading code here
ar >> m_strText;
}
// Calling the base class CRichEditDoc enables serialization
// of the container document's COleClientItem objects.
// TODO: set CRichEditDoc::m_bRTF = FALSE if you are serializing as text
CRichEditDoc::Serialize(ar);
}
thanks very much.

