Posts by enricorav

    i need to store a lot of RTF documents on a database.
    All this documents are readed from a WPRichText component.
    It's better if i use a TMemoField or a TWideMemoField on a database to store this documents?
    RTF documents are stored as only ASCII character also if there are chinese or some other unicode languages text in the document? If this is true i can use a TMemoField. This will be true also in the future version of WpTools (i read some topic here about arabic wptools support) ?

    Best regards,

    WpTools 6.20
    RadStudio XE

    Hi Julian
    i try to make some improvement to my mail-merge procedure to create a unique RTF document as a result of a sequence of mail-merge using WpReporter.
    I have a TWPRichText who is the source for TWPSuperMerge (will call it WPTemplate) another TWPRichText who is the result of the merge (will call it WPMerge) and the last TWPRichText will contain the final document (will call it WPAllMerge).
    The mail-merge will process a sequence of "Templates" one-by-one and will create the final document appending any single document as a separate section. I need to preserve header, footer, page settings and page margins of the appended document.
    The problem is: for some sections this process seem to work but for some other sections the page margins (left/right) are not the same as the source document.

    This is who i do
    1) clear WPTemplate, WPMerge and WPAllMerge

    2) load one template into WPTemplate

    WPTemplate->Clear();WPTemplate->LoadFromFile(fileName, false, "");WPTemplate->CPPosition = 0;

    3) assign header and parStyle from WPTemplate to WPMerge

    WPMerge->Clear();WPMerge->Header = WPTemplate->Header; // Assign page propertiesWPMerge->ParStyles()->Assign(WPTemplate->ParStyles());SuperMerge->SetSourceDest(WPTemplate->Memo->RTFData, WPMerge->Memo->RTFData);

    3) run SuperMerge->Execute() to create merged document into WPMerge

    4) append WPMerge to WPAllMerge as a new section (preserving header and footer, page settings and page margins of WPMerge) using this procedure:

    void __fastcall TMailMergeEngine::AppendAsSection(TWPRichText * WPSource, TWPRichText * WPDest, bool headerAsSource){   TWPRTFSectionProps * sectionprops;   TWPRTFDataBlock * textblock ;   int i;   // Create a new Page if required   if (WPDest->IsEmpty())   	WPDest->CheckHasBody();   else   {   	WPDest->CPPosition = MaxInt;   	WPDest->InputString("\f",0);   }   // Create a new section   sectionprops = WPDest->ActiveParagraph->StartNewSection();   // Assign the default page size   if (WPSource == WPMerge)   	sectionprops->Assign(WPSource->Header);   //sectionprops->Select = [wpsec_PageSize,wpsec_Margins];   sectionprops->Select << wpsec_PageSize << wpsec_Margins << wpsec_SelectHeaderFooter;   // Copy all header + footer into certain section   for (i=0; i < WPSource->HeaderFooter->Count; i++ )   {   	TWPRTFDataBlock * src = WPSource->HeaderFooter->Items[i];   	if ( src->Kind == wpHeader || src->Kind == wpFooter )   	{   		textblock = WPDest->HeaderFooter->Append(WPSource->HeaderFooter->Items[i]->Kind,   															  WPSource->HeaderFooter->Items[i]->Range,   															  WPSource->HeaderFooter->Items[i]->Name );   		textblock->UsedForSectionID = sectionprops->SectionID;   		textblock->RtfText->Assign(WPSource->HeaderFooter->Items[i]->RtfText);   	}   }   // The current paragraph starts this section   WPDest->ActiveParagraph->SectionID = sectionprops->SectionID;   // Go to end of file   WPDest->CPPosition = MaxInt;   //i need to insert a space before coping the text otherwise i cannot see section start simbol on editor   WPDest->InputString(' ', 0);   // Copy the text as part of a certain section   WPDest->SelectionAsString = WPSource->AsANSIString("RTF");}

    5) repeat the sequence from step 2 for all documents who i need to process

    6) Assign all WPAllMerge contents to WPMerge with this procedure

    void __fastcall TMailMergeEngine::CopyWPText(TWPRichText * WPSource, TWPRichText * WPDest){	WPDest->Clear();	WPDest->AsString = WPSource->AsANSIString("RTF");}

    7) save WPMerge on a RTF file

    8) open the RTF on a TWPRichText to show or edit it

    I tried also to append sections using this code as in your example but the result are worst:

    TWPRTFSectionProps * sectionprops = WpEngine->WPAllMerge->HeaderFooter->AppendAsSection(WpEngine->WPMerge->HeaderFooter)
       sectionprops->Select = sectionprops->Select << wpsec_SelectHeaderFooter

    Where is the error?

    Best regards,
    Enrico Raviglione.

    RadStudio 2010 C++Builder personality
    WpTools v 6.16

    Hi Julian,
    i have modified procedure TDBWPEvalEngine.DoDBCommand to better support empty date/time field and some numeric field type, perhaps you can insert my little changes on standard WpReporter deployment.

    Best regards,

    Well this is the scenario:
    - i'm using WpReporter to do mailmerge and this work fine, this aren't the problem.
    - i need to modify the rtf document who i use as a source of the mail-merge process before start the mail-merge, will call it rtf1.

    This its who i need to do:
    1) into a TWPRichText i load "rtf1" document from a file on disk;
    2) i need to append at the end of "rtf1" body another document: "rtf2"
    3) i don't want page break
    4) i don't want section break
    5) i don't want change the header setting of "rtf1" (page size, margins, etc, etc);
    6) rtf2 document it's stored into a DB MemoField.

    Which are the fast/best method to do this step?

    I'm sorry if I was not clear before.

    Enrico Raviglione

    Martens solutions work perfectly but i have discovered who is not who i need because wprtf1 is a mail-merge source so i need to add the text as a "Footer band" at the end of the body and not as a real Footer.
    Wich is the fast method to append rtf text at wprtf1 if the text are previously stored into a db memo field by a TDBWPRichText component?

    Thanks and sorry for my previous question.
    Enrico Raviglione

    RadStudio 2010 C++Builder personality
    WpTools v 6.16

    Hello Julian,
    i need to copy the body of TWPRichText1 as a Footer in a TWPRichText2.
    I try this but dont work:

    for (int i=0; i < WPRtf2->HeaderFooter->Count; i++)
        WPRtf1->HeaderFooter->Get(wpIsFooter, wpraOnAllPages, "")->RtfText->AsString = WPRtf2->HeaderFooter->Items[i]->RtfText->AsString;

    How can i do?

    Best regards,

    RadStudio 2010 C++Builder personality
    WpTools v 6.16

    I tried to print some chinese report from WpTools 6 to wPdf and i see some strange behaviour, some character and only sometimes seem to be missunderstanded and the PDF don't show exactly the same chinese simbols.
    If i print the same report to a printer (alwais from the same wptools object) the text are printed correctly.

    How i must set wPdf component for support chinese/asian character?

    Im using RAD Studio 2010 C++Builder personality, last version of WpTools6 with wpMailMerge and wPdf.

    Best regards,

    Hi Julian
    i write the code below but nothing appear into the PDF file.
    The produced PDF files are alwais (2.244 byte) big, the same size if i don't do the CadPrint ( hDwg, false, DC ); instruction.

    I attach here my simple code any help would be appreciated.

    Best regards,

    Hi Julian, i use an external DLL to view and print CAD draw.
    I need to print the CAD draw into a PDF, the DLL have a function as this:

    BOOL CadPrint (
    VDWG hDwg, // handle to CAD object
    BOOL bPrintStamp, // stamp's visibility
    HDC hPrinterDC // handle to printer device context

    Can i pass wPDF canvas HDC as hPrinterDC ?
    I tryied to do that but i don't see nothing on the PDF, i need to set something else or what i try to do it's simply 'stupid'?

    Best regards,

    Hi Julian,
    i need to create a PDF file from a CAD dll. This CAD dll can print it's draw on a default printer or on a specific HDC.
    Here my C++Builder function used for print from this CAD dll:

    Can i use wPDF as a specific printer ?

    Hi Julian,

    the bugs who i have reported are not about Tabs. I know who WpTools are not resposible for differences in the display caused by problematic use of tabs.

    The bugs who i have reported are:


    1) On First Page: The image are positioned more right comparing them with WpTools4, please verify if this may be a more serious bug in some procedures.

    2) On Page n. 5: Table are not displayed as in WpTools4 and MsWord.

    Into the bitmap attached to my e-mail i have circled in red where are the difference.

    Hi Julian,

    i sended to you an e-mail in date 30.09.2005 :


    i found other 2 problem comparing WpTools5 and WpTools4 as you can see in my attachments.

    1) The image are positioned more right comparing them with WpTools4, please verify if this may be a more serious bug in some procedures.

    2)Table are not displayed as in WpTools4.

    Attached to the email you have my examples.

    Hi Julian,

    using the same RTFDataProps for both edits, the template and the destination, WPReporter work fine. Most of the problems disappear.

    I sended to you an e-mail with an attachments with descriptions, examples and screenshot of all the remaining little bugs who i found.

    Thank you very much.

    Hi Julian,

    also for me there are some problems with numbers and bullets.
    If i open a document with Wpt5, i save it, then i re-open the document the bullets symbols are changed. Before i have a minus symbol '-' after i see a little square.

    Instead using WpReport (for read a template and generate a report) in my final document i lost some numbers and bullets who are presents into the original template. But attention, not all the paragraphs with numbers and bullets but only some parts of the document are affected by the problems.

    I already tried your solution {$IFNDEF SAVE_ALL_NUMSTYLES_WPT} but don't solve the problem.