in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

StartOverlay EndOverlay same as VsPrinter

Last post 03-25-2008 12:27 PM by C1_Dima. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-19-2008 11:35 AM

    StartOverlay EndOverlay same as VsPrinter

    Is there any method for C1Printdocument same as startoverlay and endoverlay for VsPrinter?

    My old program prints new content at specific location on speicific page depends on what was printed on that page while the document was being generated. It does that after docuement is generated using startoverlay and endoverlay method for vsprinter using page number.

    is there any equivalent method?

  • 03-19-2008 3:45 PM In reply to

    Re: StartOverlay EndOverlay same as VsPrinter

    See my reply in your other thread. As I tried to explain already, in C1Preview it is not recommended to use overlay to update the document's content after it's been created - it is a much better idea to simply change that content and re-generate the document.

    BTW, a good approach to create documents where you may need to change/update some values later is to use tags. Simply put, tags are placeholders in the document content which can be replaced with actual values when the document is generated. Each tag is a key (name) - value pair, the tags collection is accessed via the C1PrintDocument.Tags collection, a tag may be referenced in the text of a RenderText or RenderParagraph object by including its name in TagOpenParen/TagCloseParen (square brackets by default). E.g.:

      C1PrintDocument doc = new C1PrintDocument();
      doc.Body.Children.Add(new RenderText("'mytag1' is [mytag1].");
      ...
      doc.Tags.Add(new Tag("mytag1", "The text of mytag1"));
      doc.Generate();

    will produce the document with the text:

      'mytag1' is The text of mytag1."

    Attached is a small sample demonstrating this. Hope this helps.
     

    Cheers,
    Dima.
  • 03-20-2008 10:17 AM In reply to

    Re: StartOverlay EndOverlay same as VsPrinter

    It is not going to work with my program. What my old program with VSprinter does is,

    displays and prints multiple documents (manifests). The manifests has multiple services. Each service may hold more then one page for records. I used AddTableArray method to print recordset for the service with VSPrinter. For example there are 2 manifests with 2 services each has to be printed. The program first prints summary page for first manifest. If first manifest->first service has 2 pages data. then it prints first manifest->first service name in the header content for 2nd and 3rd pages. If first manifest->second service has 1 page data then it prints first manifest->second service name in the header content for 4th page. On the first manifest each page header has page numbering. It means 1 of 4, 2 of 4 etc.

    Then summay page for second manifest starts. and then service data for that manifest. The page numering resets again for this manifest. It means again it starts with 1 of 4, 2 of 4 etc. assuming this manifest has 4 pages.

    Under VSPrinter new page event I keep track of which page has which manifest and which service. So at the end once the docuemt is generated I used startoverlay for each page and print the header on each page with the manifest nubmer, service name and page number.

    Is it possible to do this with C1Printdocument?

  • 03-24-2008 1:38 PM In reply to

    Re: StartOverlay EndOverlay same as VsPrinter

    Yes, this is possible (and quite easy, in fact), and does not require overlays. Attached is a sample showing how to do that. I may have missed some points in the description of your program, but hope the main idea is clear and applicable in your case. The key points are:

    • For each of your "manifests", create a separate RenderArea to represent it.
    • Set the PageNumberingChange on that RenderArea:
      manifest.PageNumberingChange = new PageNumberingChange(PageNumberingChangeModeEnum.Set, 1);
      This will make sure [PageNo] and [PageCount] tags are "local" to the manifest.
    • Optionally, use tags to print totals and the like.
    For details, see attachment. Let me know whether this helps.
    (BTW, note that tags - including [PageNo] and [PageCount] - may be used anywhere in the document, not necessarily in the page headers/footers.)
    Cheers,
    Dima.
  • 03-25-2008 10:53 AM In reply to

    Re: StartOverlay EndOverlay same as VsPrinter

    Thanks a lot Dima. It is a big help for me. It seems it is much simpler than  VSPrinter.

  • 03-25-2008 12:27 PM In reply to

    Re: StartOverlay EndOverlay same as VsPrinter

    Glad it helped - thanks for letting me know. 

    Cheers,
    Dima.
Page 1 of 1 (6 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.