Beiträge von mhe

    Hello Julian,

    Thanks, now I use WritingAttr.SetFontCharset as you suggested.

    Code
    [...]
    RTF.CPPosition := FoundPosition;
    RTF.WritingAttr.SetFontCharset(RUSSIAN_CHARSET);
    RTF.InputStringW(UTF8D(Output));
    [...]

    There is still a problem: The code above is used in a loop which replaces tags within an RTF-document. (e.g. <lastname> ist replaced by Smith). The tags may be organized in tables. The SetFontCharset command seems only to work in the first row and first column of a table, but not in the other columns and rows!
    In my code, I only jump to the position of the tag by using RTF.CPPosition:= FoundPosition. Is there anything else I have to do?

    Hello,

    I can successfully insert russian characters into an RTF-file by using RTF.InputStringW("mytext"). The RTF-Preview shows it correctly, but when creating the PDF-file out of it (via wPDF) the russian characters have all gone (empty output).
    I use the current version of wPDF and WPTools5 and Acrobat 7 for viewing.

    I tried to initialize the wPDF-class with this:

    Code
    WPPDFExport.Canvas.Font.Name := 'Arial';WPPDFExport.Canvas.Font.Charset := RUSSIAN_CHARSET;WPPDFExport.FontMode:= wpEmbedSubsetTrueType_Charsets;WPPDFExport.Source := RTF;

    I've also tried to set the charset explicitly before inserting the text:

    Code
    RTF.CPAttr.CharSet:= russian_charset;
    RTF.InputStringW(s);

    Is something missing?

    Hi,

    Thanks for the tip. I took AssignPrintProperties, and the OnTextObjGetTextEx event is called. Problem now: The headline always shows the same chapter headline! (Actually the name of the last chapter).

    When debugging I noticed that _CurrPaintedObjPageNumber was always the number of the last page, no matter what page is displayed in the preview.

    Code
    i := BodyText.Pages[Memo._CurrPaintedObjPageNumber].FindFirstTextLine;

    Any idea?

    Hello,

    I want to automatically display the appropriate chapter name in the header section of a page. For example: Usually a book consists of number of chapters, the reader wants to know, in which chapter he is and looks at the header to find the current chapter. The chapter name is repeated in the header section on each page, until a new chapter begins.

    What is the best way to implement this? I thought of generating a bookmark at the beginning of each chapter. In the OnGetSpecialText event I search from the current page back, until a page with a bookmark is found, then I set the header with the chapter-text belonging to the bookmark.

    Is there a better idea, or an already existing solution/sample code to this?

    Thanks

    Hi,

    meanwhile I figured out that the preview does not work correctly. When saving the document as RTF-file, the headers and footers are correct, but the preview window shows only header and footer of the first document!

    I tried it with the standard preview dialog like this

    Code
    RTF.SaveToFile('d:\test.rtf');
    WPPreviewDlg1:= TWPPreviewDlg.Create(nil);
    WPPreviewDlg1.EditBox:= RTF;
    WPPreviewDlg1.execute;

    test.rtf is correct, preview not

    any idea? (I have v5.17.4)

    Hello,

    I want to create an RTF-Document by appending smaller RTF-documents. Each RTF-document can have its own header/footer. I use the AppendAsSection function somewhat like this:

    Code
    for i:= 0 to NumberOfModules - 1 do begin
      TempRTF := TDmsText.CreateDynamic;
      TempRTF.LoadFromStream(Database.ReadDmsModule(ModuleList[i]), '', True);
      RTF.HeaderFooter.AppendAsSection(TempRTF.HeaderFooter);
    end;

    The whole document has header and footer of the first RTF-document in the module-list. The headers and footers of the other documents are ignored!

    what's wrong with this?

    And how is it done exactly?

    this is an excerpt of the TOC code which does not produce the correct result

    [...]

    Code
    ActiveParagraph.TabstopAdd(Header.PageWidth -
            Header.LeftMargin - Header.RightMargin - 560, tkRight, tkDots);
     InputNewObject(wpobjReference).Name_Spaces := bobj.Name;


    [...]

    there is a tkRight, what is missing?

    Hello,

    How can page numbers in the TOC be correctly right aligned?

    Example (displayed in fixed font, to get the idea):

    Code
    1 Chapter 1.................1  1.1 Chapter 1.1...........33  1.2 Chapter xyz...........123

    But it should look like this:

    Code
    1 Chapter 1.................1
      1.1 Chapter 1.1..........33
      1.2 Chapter xyz.........123

    Changing the paragraph alignment to paralRight is no solution cause the chapter numbers on the left are not aligned anymore...

    any idea?

    In the CreateTableOfContents procedure, bookmark names are created by using GetTickCount to create a unique bookmark identifier. This is somewhat dangerous because the time between to GetTickCount calls could be smaller than a tick...(I use a dual core 3GHz computer)
    I have the symptom, that identical page numbers are shown for different head lines. They might use the same bookmark identifier.
    I would suggest to add a counter to the tick value which is incremented after each call to GetTickCount.

    e.g.:

    bobj.Name := BookMarkId + IntToStr(GetTickCount + Increment);
    Inc(Increment);

    or set Increment initally to GetTickCount and only use Increment

    or do not use GetTickCount at all and only use the increment value...

    Hello,

    My problem: I want to generate a document that may contain special pages which should be printed using a different printer tray (bin). This tray keeps keeps colored paper instead of white paper, paper size is all the same.
    Is there a way to do this. I've heard that the printer bin can be set for the first and the rest of the papers. But can it be done individually?

    Thanks
    Mike

    Hello,

    I want to create PDF documents including WMF-files. The quality of the WMF file included in the PDF is quite low, since it is rendered in a fixed solution (as defined within the WMF file). If I create a PDF with the same WMF file using the WPTools4 Wordprocessor Demo, the quality is fine, independent of the zoom level.

    Here's an example code

    So what is wrong? Using WPPDFExport.ConvertMetafileToBitmaps:= false has also no effect.

    I'm using a the latest version of wPDF and WPTools.

    Mike