PrintPreviewControl and HTML
-
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.
-
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.
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 -
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.4I 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
-
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
-
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 -
Can you explain more about the second one?(Maybe an article or something?)
Every new thing you learn,Gives you a new personality.
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 -
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.4You 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.