Beiträge von hrc1966

    The task is to create a document from other documents. Before inserting a document I must add a bold line with the creation date, creator and the title.

    Code
    procedure TDokumentData.BuildRtfDocument(aWPRichText: TWPRichText);var  st: string;  MemoryStream: TMemoryStream;begin  MemoryStream := TMemoryStream.Create;  try    if not Tomt then      if not LoadToStream(MemoryStream) then        raise Exception.CreateFmt('Kunne ikke indlæse %d: %s',[DokumentRef,Overskrift]);    aWPRichText.SelStart := aWPRichText.GetTextLen;    aWPRichText.WritingAttr.Clear('Verdana', 10);    aWPRichText.WritingAttr.SetFontStyle([fsBold]);    st := #13#10#13#10#13#10 + DateToStr(Oprettet) + '    ' + BrugerInit + '    ' + Overskrift + #13#10#13#10;    aWPRichText.InputString(st);    aWPRichText.WritingAttr.SetFontStyle([]);    MemoryStream.Seek(0,soFromBeginning);    aWPRichText.LoadSelectionFromStream(MemoryStream);    aWPRichText.ReformatAll(false);  finally    MemoryStream.Free;  end;end;

    Now, sometimes a document is empty but the line needs to be printed anyway. The stream is empty so the aWPRichText.LoadSelectionFromStream dows nothing. What happens then is that the caption is hacked up and printed several lines below. A line would look like this: <date> <creator> <tit \n\n\n le>.

    The snag is that after the documents are inserted a header and footer is constructed. Here is the first part of that method:

    I have tried a lot but with little success. If anyone could point out the what is wrong or if anything could be done smarter (e.g. using the rather undocumented InputParagraph), please do.

    Thanks in advance.

    I finally managed to do a fix that added shortcuts to the 3 styles and kept functionality in one place (in the TWPRichText.OnKeyDown).


    Thanks for the input.

    Using the buttons the OnCharacterAttrChange is triggered, whereas the home made piece of code doesn't. The best solution will be that the buttons and shortcuts were same code. I'll go look for that now.

    When it is triggered the code is saved. The bold made by the code above wasn't saved whereas button-bold's were.

    I cannot find the code that the tool-bar uses. Is there really no way to attach a shortcut to these buttons? So I tried this, which doesn't work.

    Depending on size and situation it may reside as a encrypted file or in a blob-field.

    I don't use dataset though. I do this:

    Code
    var  MemoryStream: TMemoryStream;begin  MemoryStream := TMemoryStream.Create;  try    WPRichText1.SaveToStream(MemoryStream);    MemoryStream.Seek(0,soFromBeginning);    result := aDokumentData.SaveFromStream(MemoryStream);  finally    MemoryStream.Free;  end;

    Save from stream determines where to put data

    We have discovered that the problem only occurs when creating new documents. We can make 1-n fields bold but when we save it's ignored. When editing the document, adding bold-fields, it saves correctly.

    When I tried what you suggested, I found out that I had nowhere to put that code-snippet. We use a TWPToolBar

    I'll reuse this post. Found out that my colleague added his parallel piece of code to handle those shortcuts:


    I'd better try to remove the redundancy here. Somehow call the button or find a shared TAction somewhere.

    I have added .Changing to the OnCharacterAttrChange. I'll go on testing.

    Are we (the company I work for) the only one experiencing this problem? Many have read this post but none has added comments.
    This issue has reached a political state. So ever small it may seem some customers are really bugging us about it. Comments or hot-fixes are welcomed.

    If you type some text, press ctrl-b and continue typing, the text naturally becomes bold. Now try to save the text and open it again. The style wasn't saved.

    If you mark text and "bold" it, it is saved correctly.

    It seems that the document needs a tag finishing the bold text (actually it should continue in bold when opened)

    Still there's the other problem where the first character is eaten by the editor if it is typed in a cell next to a protected cell.

    We have bypassed that one by unblocking a space character at the end

    The flag worked btw.

    We have encountered two problems with protected text that we would like to report:

      When text is marked as protected, the text is not entirely protected since it is possible to mark some of the protected text and delete or replace it.

      In a table with to rows: Text in row 1 is protected. When user type in row 2 the first character typed is not shown.

    Zitat

    The stupid question: Why can't the action do the same as the suggested workaround? Wouldn't that fix what someone would call a bug?

    The actions always work with "the current" editor. If there is no current editor it won't do anything. So the action is somewhat different the direct access of an objects interface. I see no bug here.

    Julian

    In the program I have tried that already, issuing a BeginDoc before I loop through all the documents (that be rtf-documents, scannings and PDFs') and ending the job with EndDoc.

    When I load the WP-document and start printing it, it itself issues a set of Begin- and EndDoc, thus raising an exception. Had WP checked the printer state and only issued Begin-/EndDoc when needed there would have been no apparent problem.

    No doubt that it generally is a very bad idea but some of the WP-forms seems to be .. made in haste. Went through the tab-dialog and put the taborder in order. The altered font and size was deleted and I did other things. It is not the only form that need a makeover. Are you encouraging us to make our own dialogs or should vi alter yours? Are they overwritten when updating (they probably are)?

    Our customer want to print a number of documents within one print job. That way he can generate one PDF-file containing a patients whole journal. TWPRichEdit could come about that by checking if printer already was printing. Something like this:

    This is how I think it could be done. A NewPage in the beginning or end is something the application must deal with. Is this something that could be considered or are there other ways to accomplish it?

    tia/hrc

    We just upgraded to WPTools 6.0.7 (information in components are not updated, states this is 6.0.1). A client (not our idea) placed graphics in the document header and footer. The graphic width is wider that the area available within the margins and now the graphic is right aligned (almost out of view). If we adjust the size and save, the problem is fixed - but this is a problem within +1000 documents.

    I suspect this an error I can address to you.

    If you need I can supply a document.