Beiträge von manphys

    Hi! I have an application that uses a table do format the look of my header. There is a image, the company logo. I'm using version 5.R15, and the code is that:

    Here I create the header and footer:

    Code
    var img: TWPOImage;    obj: TWPTextObj;    tbl: TParagraph;begin   {cabeçalho}   wpAuxiliar.Clear;   wpAuxiliar.ClearHeaderFooter;   wpAuxiliar.CheckHasBody;   img := TWPOImage.Create(wpAuxiliar);   img.LoadFromFile(DirRelatorios+'\ima\logomarca.bmp');   tbl := wpAuxiliar.TableAdd(2, 1, [], nil, nil);   tbl.Cols[0].ASetFontName('Arial');   tbl.Cols[0].ASet(WPAT_CharFontSize, 1200);   tbl.Cols[0].ASet(WPAT_COLWIDTH, 7500);   tbl.Cols[0].ASetAddCharStyle(WPSTY_BOLD);   tbl.Cols[0].Align := paralLeft;   tbl.Cols[1].ASetFontName('Arial');   tbl.Cols[1].ASet(WPAT_CharFontSize, 1200);   tbl.Cols[1].ASet(WPAT_COLWIDTH, 3000);   tbl.Cols[1].ASetAddCharStyle(WPSTY_BOLD);   tbl.Cols[1].Align := paralRight;   tbl.Rows[0].Cols[0].SetText('PACIENTE: ' + nome_paciente.Text+#13+#10+                               'MÉDICO: ' + BuscaMedicoSolicitante +#13+#10+                               'EXAME: ' + descexame_resultado.Text+#13+#10+                               'DATA: ' + data_resultado.Text);   obj := tbl.Rows[0].Cols[1].AppendNewObject(wpobjImage, false, false, 0);   obj.ObjRef := img;   wpAuxiliar.CurrAttr.FontName  := 'Arial';   wpAuxiliar.CurrAttr.Size      := 12;   wpAuxiliar.CurrAttr.Color     := clBlack;   wpAuxiliar.CurrAttr.Alignment := paralCenter;   wpAuxiliar.CurrAttr.SetFontStyle([fsBold]);   wpAuxiliar.InputString(#13);   wpAuxiliar.InputString('Laudo'+#13);   laudo_resultado.HeaderFooter.Get(wpIsHeader, wpraOnFirstPage,'').RTFText.AsString := wpAuxiliar.AsString;   laudo_resultado.HeaderFooter.Get(wpIsHeader, wpraOnAllPages,'').RTFText.AsString  := wpAuxiliar.AsString;   {Rodapé}   wpAuxiliar.Clear;   wpAuxiliar.ClearHeaderFooter;   wpAuxiliar.CheckHasBody;   wpAuxiliar.CurrAttr.FontName  := 'Arial';   wpAuxiliar.CurrAttr.Size      := 12;   wpAuxiliar.CurrAttr.Alignment := paralLeft;   wpAuxiliar.CurrAttr.SetFontStyle([fsBold]);   wpAuxiliar.InputString(nome_profissional.Text+#13);   wpAuxiliar.InputString(Crm+#13);   laudo_resultado.HeaderFooter.Get(wpIsFooter, wpraOnLastPage,'').RTFText.AsString := wpAuxiliar.AsString;   laudo_resultado.HeaderFooter.Get(wpIsFooter, wpraOnAllPages,'').RTFText.AsString := '';

    And here I choose the apropriate header and footer on the fly:

    In my form I have a control page, with 2 tabs. The second tab hold the WPRichText component. So, when I change to the second tab, the screem turns blank and the application crashs. Someone can help me??

    Thanks

    Hi Julian! Above is a sample of a text with the problems.

    Thanks

    Hi! I'm trying to load documents saved with version 4 in my new project with WPTools 5. The problem is, when I load the text (WPRichText1.AsString := Query1.FieldByName('Text').AsString), the spacing between the paragraphs is all messed(too large!). Then I copied the text and paste in MS Word, and find out that Linespacing is 50 pts!! Is this a Bug?? How can I fix this?? Currently using version 5.0 Realease 12.

    Thanks!

    Thanks Julian!! I used the code below and it's working very well! If you think that it's not okay or there is a better solution, please tell me!


    Thanks again!!

    Thanks Julian! It worked!! But, only when the document have more than one page. When the document have just one page, the footer dosen't show. How can I fix this??

    Thanks

    EDIT:

    The code below seems to wrk. But, in wich event I should call it for better performance??

    Code
    WPRichText1.HeaderFooter.Get(wpIsHeader, wpraOnAllPages,'').RTFText.AsString := 'Header On All Pages';
       if WPRichText1.PageCount > 1 then
       begin
          WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnFirstPage,'').RTFText.AsString := '';
          WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnLastPage,'').RTFText.AsString  := 'Footer On Last Page';
       end
       else WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnFirstPage,'').RTFText.AsString := 'Footer On Last Page';

    I tried this too, but didn't work either:

    Code
    procedure RemoveTag(var Editor: TWPRichText; TagName);
    begin
       TagName := Concat(TagStart, TagName, TagEnd;
       Editor.BookmarkSelect(TagName, False);
       Editor.CurrAttr.DeleteStyle([afsProtected]);
       Editor.ClearSelection;
       Editor.SelectionAsString := '';
       Editor.HideSelection;
       Editor.Refresh;
    end;

    Here is the code I'm using:

    Something wrong with that??

    Thanks

    Thanks Julian, but i'm already using BookmarkSelect and ClearSelection. The first time, everything goes well, but when I insert a new bookmark in the same place, and then delete tha bookmark, the bookmark is deleted from the bookmark list, but the text remains. I don't understand this... :shock:

    Ok, I already figured out how to delete the bookmark with right-click. But now, I have another problem: when I delete a bookmark the first time, averything goes fine. So, I add another bookmark in the exact same place where the other were. Now, when I delete that second bookmark, it is delete from the bookmark list, but the text remains in the WPRichText component until I the application is closed. Please, somebody help me.


    And sorry for my bad english...

    Thanks Julian! But, i still have one problem: how to find out if one document can fit in the remaing space of the page or not. Cause i have to load a document to the WPRichText, but before load the next document, i need to know if there is enough space in the current page. if not, i must create a new page and load that document in that new created page. How can i do this??

    Thanks

    Zitat von Olivier Gagnon

    Use the properties WPRichtText.BeginUpdate and WPRichtText.EndUpdate and print the documents one after each other.

    But, in this way, each document wil be printed in a page, right?? But i need to put, in the same page, all the documents that fit in that page. If the next document don't entirilly fit in the current page, i have do send it to the next page. The problem is how to find out if the document can fit in the page or not.

    Thanks.

    Hi!

    I have several texts in a database that must be printed all together. So, i want to know how is the easiest way to load every text in one WPRichText, one after one, keeping the format. I already figured out a way to do this, but i need to know if the next text i'm loading into the WPRichText can fit in the current page. If not, it MUST be loaded in a new page!! How can i do this!?!?

    Thanks, and sorry for the poor english :oops: