Beiträge von fanderlf

    Hello,
    I wanted to use use TDBWPRichText for several simple Text input fields in our program.
    I use the Default Editor. The function looks as the following:

    Code
    void OpenAndEdit(TWPCustomRichText *Source, bool ReadOnly){  WPToolsEditor->WPRichText1->AsString = Source->AsString;  WPToolsEditor->ShowModal();  if(!ReadOnly)    Source->AsString = WPToolsEditor->WPRichText1->AsString;  Source->ReformatAll(true,true);}

    The code works fine as the changes I did in the Default Editor appear in the TDBWPRichText. The only Problem is that if I post the table and commit it to the DB nothing appears in the Database and the entries are lost :(
    If I type something into the Source Editor after editing in the Default Editor and before posting, the changes are saved to the Database. It seems that if I only use the Default Editor TDBWPRichText doesn't recognize that something has changed and doesnt save anything to DB.
    Is there any possibility to get arround this? I'd really like to use TDBWPRichText.

    I also tried to set

    Code
    Source->Modified = true;


    after Reformating, but that didn't help, too :(

    Any help is appreciated :)

    Thanks in advance,
    Florian Fanderl

    ok :) thank you

    I can't edit your function, because we got C++-Builder and it doesn't allow editing Delphi code.
    So I'll do manual numbering... the paragraph is plain text then (from the view of the table of contents) and then there shouldn't be any Problem with the numbering :)

    I just thought that I missed something :)


    Thank you

    Greetings,
    Florian Fanderl

    Hello,
    Is there any easy way (without coding it manually) to get a numbering in the talbe of contents?

    It should look like this:

    Table of Contents
    A. Headline1...................................................1
    A.1. Headline1Sub1.........................................1
    A.2. Headline1Sub2.........................................2
    B. Headline2
    C. Headline3
    C.1. Headline3 Sub1
    C.2. Headline3 Sub2
    C.3. Headline3 Sub3

    < Some Text >

    A. Headline1

    < Some Text >

    A.1. Headline1 Sub1

    < Some Text >

    A.2. Headline1 Sub2

    < Some Text >

    B. Headline2

    < Some Text >

    ......

    The Code I'm using now looks like this:

    Code
    TParagraph *Par;  TWPRTFNumberingStyle *MyNumberStyles[3];  MyNumberStyles[0] = wp_Document->NumberStyles()->AddOutlineStyle(1,1);  MyNumberStyles[0]->Style = wp_lg_a;  MyNumberStyles[0]->TextA = ".";  MyNumberStyles[0]->TextB = "";  MyNumberStyles[0]->Font = "";  MyNumberStyles[0]->Indent = 360;  MyNumberStyles[0]->UsePrev = true;  MyNumberStyles[1] = wp_Document->NumberStyles()->AddOutlineStyle(1,2);  MyNumberStyles[1]->Style = wp_1;  MyNumberStyles[1]->TextA = ".";  MyNumberStyles[1]->TextB = "";  MyNumberStyles[1]->Font = "";  MyNumberStyles[1]->Indent = 720;  MyNumberStyles[1]->UsePrev = true;  MyNumberStyles[2] = wp_Document->NumberStyles()->AddOutlineStyle(1,3);  MyNumberStyles[2]->Style = wp_1;  MyNumberStyles[2]->TextA = ".";  MyNumberStyles[2]->TextB = "";  MyNumberStyles[2]->Font = "";  MyNumberStyles[2]->Indent = 1080;  MyNumberStyles[2]->UsePrev = true;  Par = wp_Document->FirstPar;  wp_Document->InputMergeField( WPTOC_FIELDNAME,"Toc created here...","",0,' ');  Par = wp_Document->InsertPar();  Par->Append("History");  Par->ASet(WPAT_NumberSTYLE,MyNumberStyles[0]->ID);  Par->ASet(WPAT_NumberLEVEL,1);  Par->ASetCharStyle(true,WPSTY_BOLD);  Par->ASet(WPAT_ParIsOutline,1);  wp_Document->InsertPar();  dbrt_Buffer->DataField = "HISTORY";  wp_Document->FastAppendText(dbrt_Buffer,false);  Par = wp_Document->InsertPar();  Par->Append("Deviations");  Par->ASet(WPAT_NumberSTYLE,MyNumberStyles[1]->ID);  Par->ASet(WPAT_NumberLEVEL,2);  Par->ASet(WPAT_ParIsOutline,1);  wp_Document->InsertPar();  dbrt_Buffer->DataField = "DEVIATIONS";  wp_Document->FastAppendText(dbrt_Buffer,false);  Par = wp_Document->InsertPar();  Par->Append("Test");  Par->ASet(WPAT_ParIsOutline,1);  Par->ASet(WPAT_NumberSTYLE,MyNumberStyles[2]->ID);  Par->ASet(WPAT_NumberLEVEL,3);  wp_Document->InsertPar();  dbrt_Buffer->DataField = "DEVIATIONS";  wp_Document->FastAppendText(dbrt_Buffer,false);  wp_Document->DelayedReformat();

    This sets up the document and marks the headlines as ParIsOutline

    To build up the TOC I use following code:

    Code
    TWPCreateTableOfContentsMode MyMode;
    
    
      MyMode = MyMode << wptocUseParIsOutline << wptocCreateOutlineBookmarks << wptocCreateHyperlinks << wptocCreateHyperlinkNumbers;
    
    
    wp_Document->CreateTableOfContents("Table of Contents","Toc_",MyMode,NULL,"TABLE OF CONTENTS",NULL);
    
    
      wp_Document->DelayedReformat();

    Works fine for building a ToC, but I dont see any numbering in ToC :( I tried different ways to get it, but I haven't found any way to get this running.

    At the moment it looks like:

    Table of Contents
    Headline1...................................................1
    Headline1Sub1.........................................1
    Headline1Sub2.........................................2
    Headline2
    Headline3
    Headline3 Sub1
    Headline3 Sub2
    Headline3 Sub3

    < Some Text >

    A. Headline1

    < Some Text >

    A.1. Headline1 Sub1

    < Some Text >

    A.2. Headline1 Sub2

    < Some Text >

    B. Headline2

    < Some Text >

    ......

    For our purposes it would be enough to use the complete text of the numbered paragraph as headline (the numbering doesn't need to be directly linked to the ToC as it is in Word)
    At the moment he just uses "Headline2" as text for ToC. Can I tell him to use "B. Headline2"? Tried different ways, but it just won't work :(

    But if there's a way to easily link the numbering with the ToC that would be even better :)

    Would be really great if you could help!

    Thanks in advance,
    Florian Fanderl

    Hello,
    Is there any possibility to get the absolute coordinates of table borders in header and footer? At the moment we build the document like that:

    Code
    TParagraph *par;  Cardinal txtplain;  par = wp_Document->HeaderFooter->Get(wpIsHeader,wpraOnAllPages,"")->CreateTable(NULL);  par->Name = "StandardHeader";  par->indentleft = 0;  wp_Document->WritingAttr()->Clear();  wp_Document->WritingAttr()->SetFontName("Arial");  wp_Document->WritingAttr()->SetFontSize(10);  txtplain = wp_Document->WritingAttr()->CharAttr;  par->ClearText(true);  par->ASet(WPAT_Alignment,Integer(paralRight));  par->ASet(WPAT_BorderFlags,WPBRD_DRAW_All4);  par->ASet(WPAT_BorderColor,clBlack);  TWPTableRowStyle *MyRow = par->CreateRow( NULL,true);  MyRow->ASet(WPAT_BorderFlags,WPBRD_DRAW_All4);  TParagraph *MyCell;  TWPTextObj *Image;  MyCell = MyRow->InputCell();  Image = MyCell->InsertNewObject(MaxInt,wpobjImage,false,false,txtplain);  Image->IsImage();  TMemoryStream *MyStream = new TMemoryStream();  img_Logo->Picture->Bitmap->SaveToStream(MyStream);  MyStream->Position = 0;  Image->LoadObjFromStream(".bmp",MyStream);  MyRow->InputCell();  par->EndRow(MyRow);  MyRow = par->CreateRow( NULL,true);  MyRow->ASet(WPAT_BorderFlags,WPBRD_DRAW_All4);  MyCell = MyRow->InputCell();  MyCell = MyRow->InputCell();  MyCell->Insert(0,"Page ",txtplain);  MyCell->InsertNewObject(MaxInt,wpobjTextObject,false,false,txtplain)->Name = WPTextFieldNames[wpoPageNumber];  MyCell->Insert(MaxInt," of ",txtplain);  MyCell->InsertNewObject(MaxInt,wpobjTextObject,false,false,txtplain)->Name = WPTextFieldNames[wpoNumPages];  MyCell->ASet(WPAT_Alignment,Integer(paralRight));  MyCell->ASetColor(WPAT_BGColor,clLime);  par->EndRow(MyRow);  par = wp_Document->HeaderFooter->Get(wpIsFooter,wpraOnAllPages,"")->CreateTable(NULL);  par->Name = "StandardFooter";  par->indentleft = 0;  wp_Document->WritingAttr()->Clear();  wp_Document->WritingAttr()->SetFontName("Arial");  wp_Document->WritingAttr()->SetFontSize(10);  txtplain = wp_Document->WritingAttr()->CharAttr;  par->ClearText(true);  par->ASet(WPAT_Alignment,Integer(paralRight));  par->ASet(WPAT_BorderFlags,WPBRD_DRAW_All4);  par->ASet(WPAT_BorderColor,clBlack);  MyRow = par->CreateRow( NULL,true);  MyRow->ASet(WPAT_BorderFlags,WPBRD_DRAW_All4);  MyCell = MyRow->InputCell();  Image = MyCell->InsertNewObject(MaxInt,wpobjImage,false,false,txtplain);  Image->IsImage();  MyStream->Clear();  img_Logo->Picture->Bitmap->SaveToStream(MyStream);  MyStream->Position = 0;  Image->LoadObjFromStream(".bmp",MyStream);  delete MyStream;  MyRow->InputCell();  par->EndRow(MyRow);  MyRow = par->CreateRow( NULL,true);  MyRow->ASet(WPAT_BorderFlags,WPBRD_DRAW_All4);  MyCell = MyRow->InputCell();  MyCell = MyRow->InputCell();  MyCell->Insert(0,"Page ",txtplain);  MyCell->InsertNewObject(MaxInt,wpobjTextObject,false,false,txtplain)->Name = WPTextFieldNames[wpoPageNumber];  MyCell->Insert(MaxInt," of ",txtplain);  MyCell->InsertNewObject(MaxInt,wpobjTextObject,false,false,txtplain)->Name = WPTextFieldNames[wpoNumPages];  MyCell->ASet(WPAT_Alignment,Integer(paralRight));  MyCell->ASetColor(WPAT_BGColor,clLime);  par->EndRow(MyRow);  wp_Document->DelayedReformat();

    As border we draw a rectangle as stated in the demo:

    The Problem is that if you zoom in or render the document the lines don't match.

    How Do I get the lines from the Header and Footer Tables have exactly the same coordinates as the lines we paint at the border of the page.

    Thanks in advance,
    Florian Fanderl