Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. PrintPreviewControl and HTML

PrintPreviewControl and HTML

Scheduled Pinned Locked Moved C#
htmlhardwarehelpquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dSolariuM
    wrote on last edited by
    #1

    Hi all, I have some html files (Custom Reports) and I want to show the print preview of them to the user.I don't want to use IE print preview or web browser because they are not embedded in my application and I can not control them the way I want. I was wondering if there is a way to preview a html file in PrintPreviewControl (or any other components like that)? Please help me. thank you.

    Every new thing you learn,Gives you a new personality.

    L 1 Reply Last reply
    0
    • D dSolariuM

      Hi all, I have some html files (Custom Reports) and I want to show the print preview of them to the user.I don't want to use IE print preview or web browser because they are not embedded in my application and I can not control them the way I want. I was wondering if there is a way to preview a html file in PrintPreviewControl (or any other components like that)? Please help me. thank you.

      Every new thing you learn,Gives you a new personality.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Assuming your app is a WinForms app, I see three possibilities: 1. Use a WebBrowser control and have it navigate to your HTML document. 2. Use any external app you choose (MS Word if you must), and make it show its main form inside your app, by calling SetParent (using P/Invoke). 3. create your own UserControl, that parses and interprets HTML; it is quite a job, probably not worth the effort it would take. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
      Please use <PRE> tags for code snippets, they improve readability.
      CP Vanity has been updated to V2.4

      M D 2 Replies Last reply
      0
      • L Luc Pattyn

        Assuming your app is a WinForms app, I see three possibilities: 1. Use a WebBrowser control and have it navigate to your HTML document. 2. Use any external app you choose (MS Word if you must), and make it show its main form inside your app, by calling SetParent (using P/Invoke). 3. create your own UserControl, that parses and interprets HTML; it is quite a job, probably not worth the effort it would take. :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
        Please use <PRE> tags for code snippets, they improve readability.
        CP Vanity has been updated to V2.4

        M Offline
        M Offline
        MumbleB
        wrote on last edited by
        #3

        I tend to agree. I have numerous copy-books and some of them are pretty big. Take this one for instance: 01 X30002-FUNCTION-SEG. 05 X30002-MSG-LL PIC S9(04) COMP. Message length is variable depending on number of items in the set 05 X30002-FUNC-TAG PIC X(08). ZPE0805F 05 X30002-VERSION PIC 9(02). Version Number. Must be set to 00 05 X30002-FUNCTION-INPUT. 10 X30002-HEADER. 15 X30002-BATCH-TYPE PIC X(03). P = Payment batch T = Transfer batch within a customers own profile PS = Purchase of Services batch RTI = Real-time Clearing inward batch RTO = Real-time Clearing outward batch 15 X30002-SET-TYPE PIC X(01). C = Consolidated batch. 1 Debit upto 50 credits I = Itemised batch. Upto 25 Dr/CR items 15 X30002-CUSTOMER-ID PIC X(20). A valid customer identifier from the channel. Not Validated 15 X30002-BATCH-ID PIC X(20). A unique batch identifier. Not Validated 15 X30002-SET-NUMBER PIC 9(05). The number of the set contained within the batch. Start at 1 and increment for each set within the batch 15 X30002-NOMINATED-POST-IND PIC X(01). R = Real-time post = defaults to Real-Time 15 X30002-HOMING-POST-IND PIC X(01). F = Force post R = Real-time post = defaults to Real-Time where applicable 15 X30002-CHECK-AVAIL-BAL-IND PIC X(01). Set to Y if available balance must be checked prior to posting 15 X30002-TRAN-CODE-IND PIC X(01). C = Channel D = Default = Defaults to Channel 15 X30002-NO-OF-TXNS PIC 9(03). The number of transactions contained in the homing table 15 FILLER PIC 9(08). 10 X30002-REVERSAL-DETAILS. 15 X30002-NOM-REV-PROD-CODE PIC X(03). Reversal Product Code eg DDA / TCS 15 X30002-NOM

        D 1 Reply Last reply
        0
        • M MumbleB

          I tend to agree. I have numerous copy-books and some of them are pretty big. Take this one for instance: 01 X30002-FUNCTION-SEG. 05 X30002-MSG-LL PIC S9(04) COMP. Message length is variable depending on number of items in the set 05 X30002-FUNC-TAG PIC X(08). ZPE0805F 05 X30002-VERSION PIC 9(02). Version Number. Must be set to 00 05 X30002-FUNCTION-INPUT. 10 X30002-HEADER. 15 X30002-BATCH-TYPE PIC X(03). P = Payment batch T = Transfer batch within a customers own profile PS = Purchase of Services batch RTI = Real-time Clearing inward batch RTO = Real-time Clearing outward batch 15 X30002-SET-TYPE PIC X(01). C = Consolidated batch. 1 Debit upto 50 credits I = Itemised batch. Upto 25 Dr/CR items 15 X30002-CUSTOMER-ID PIC X(20). A valid customer identifier from the channel. Not Validated 15 X30002-BATCH-ID PIC X(20). A unique batch identifier. Not Validated 15 X30002-SET-NUMBER PIC 9(05). The number of the set contained within the batch. Start at 1 and increment for each set within the batch 15 X30002-NOMINATED-POST-IND PIC X(01). R = Real-time post = defaults to Real-Time 15 X30002-HOMING-POST-IND PIC X(01). F = Force post R = Real-time post = defaults to Real-Time where applicable 15 X30002-CHECK-AVAIL-BAL-IND PIC X(01). Set to Y if available balance must be checked prior to posting 15 X30002-TRAN-CODE-IND PIC X(01). C = Channel D = Default = Defaults to Channel 15 X30002-NO-OF-TXNS PIC 9(03). The number of transactions contained in the homing table 15 FILLER PIC 9(08). 10 X30002-REVERSAL-DETAILS. 15 X30002-NOM-REV-PROD-CODE PIC X(03). Reversal Product Code eg DDA / TCS 15 X30002-NOM

          D Offline
          D Offline
          dSolariuM
          wrote on last edited by
          #4

          I'll wait.thanks

          Every new thing you learn,Gives you a new personality.

          1 Reply Last reply
          0
          • L Luc Pattyn

            Assuming your app is a WinForms app, I see three possibilities: 1. Use a WebBrowser control and have it navigate to your HTML document. 2. Use any external app you choose (MS Word if you must), and make it show its main form inside your app, by calling SetParent (using P/Invoke). 3. create your own UserControl, that parses and interprets HTML; it is quite a job, probably not worth the effort it would take. :)

            Luc Pattyn [My Articles] Nil Volentibus Arduum

            The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
            Please use <PRE> tags for code snippets, they improve readability.
            CP Vanity has been updated to V2.4

            D Offline
            D Offline
            dSolariuM
            wrote on last edited by
            #5

            Can you explain more about the second one?(Maybe an article or something?)

            Every new thing you learn,Gives you a new personality.

            L 1 Reply Last reply
            0
            • D dSolariuM

              Can you explain more about the second one?(Maybe an article or something?)

              Every new thing you learn,Gives you a new personality.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              something along these lines would show your HTML editor inside your panel "myPanel":

              Process p=Process.Start("myHtmlEditor", "someFile.html");
              p.WaitForInputIdle();
              IntPtr hWndChild=p.MainWindowHandle();
              IntPtr hWndParent=myPanel.Handle;
              SetParent(hWndChild, hWndParent);

              Adapt where necessary! And the prototype for the native Win32 function would be:

              [DllImport("user32.dll", SetLastError = true)]
              static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

              :)

              Luc Pattyn [My Articles] Nil Volentibus Arduum

              The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
              Please use <PRE> tags for code snippets, they improve readability.
              CP Vanity has been updated to V2.4

              B 1 Reply Last reply
              0
              • L Luc Pattyn

                something along these lines would show your HTML editor inside your panel "myPanel":

                Process p=Process.Start("myHtmlEditor", "someFile.html");
                p.WaitForInputIdle();
                IntPtr hWndChild=p.MainWindowHandle();
                IntPtr hWndParent=myPanel.Handle;
                SetParent(hWndChild, hWndParent);

                Adapt where necessary! And the prototype for the native Win32 function would be:

                [DllImport("user32.dll", SetLastError = true)]
                static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

                :)

                Luc Pattyn [My Articles] Nil Volentibus Arduum

                The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
                Please use <PRE> tags for code snippets, they improve readability.
                CP Vanity has been updated to V2.4

                B Offline
                B Offline
                BobJanova
                wrote on last edited by
                #7

                You have significantly less control over starting another app than you do over a web browser OCX, which the OP says isn't enough, so I doubt this solution will fulfil his needs. The best third party app for rendering HTML – a browser – is already available as a control in .Net.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups