|
-
Jul 19th, 2009, 02:24 PM
#121
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Code:
Private Sub MyWebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles MyWebBrowser.DocumentCompleted
MyWebBrowser.Print()
End Sub
Am i right sir?
then what should i do sir?
-
Jul 19th, 2009, 02:25 PM
#122
Re: Printing problem........Need some help
Looks good to me. I'd suggest trying it...
-
Jul 19th, 2009, 02:33 PM
#123
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
yes sir.........it worked......
tell me one thing sir........what does the .xps extension stands for?
and sir how to enlarge the font size of the output?
-
Jul 19th, 2009, 02:37 PM
#124
Re: Printing problem........Need some help
This goes back to what I asked you way back on page 1 - I think you are printing via some filewriter printer driver rather than an actual printer. XPS is a page layout format developed by Microsoft.
You can change font sizes by playing with the HTML code in the RenderListToHTML routine. Do you know HTML and/or CSS at all?
-
Jul 19th, 2009, 02:40 PM
#125
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
ya i know HTML sir......
But not the css
-
Jul 19th, 2009, 02:43 PM
#126
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
But sir unfortunately watching the code sir I cant understanr where to apply all those Html tags such as bold,tr,td,th,etc etc..............
One more thing sir.........If someone asks to print a gridview then does it means printing via an html(That we did now),or via excel or there are also many other methods to achieve this printing operation?
-
Jul 19th, 2009, 02:45 PM
#127
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Let me tell about myself sir........
I am a final year engg. stdnt.......
I am new to vb as well as the .net......
I know C,C++,JAVA,LINUX and A little SQl
may i know how old r u sir and r u a .net professional?
-
Jul 19th, 2009, 02:50 PM
#128
Re: Printing problem........Need some help
OK you can do it either way.. all the code is doing is building up an HTML document.
In this section (within RenderListtoHTML) :
Code:
swrOutput.WriteLine("font: 8pt verdana")
swrOutput.WriteLine("}")
swrOutput.WriteLine("tr")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana")
You can see the font size is being set to 8pt - you can just change that to 12pt or 16pt. Thats probably the easiest way.
-
Jul 19th, 2009, 02:50 PM
#129
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Attachment 72086
I got this output sir.......
Can you give me some html tags that will help me to design the printed page?
Last edited by gautamshaw; Feb 21st, 2010 at 01:22 PM.
-
Jul 19th, 2009, 02:55 PM
#130
Re: Printing problem........Need some help
If someone asks to print a gridview then does it means printing via an html(That we did now),or via excel or there are also many other methods to achieve this printing operation
Gridviews don't have built in print functionality so you need to implement something yourself. You can do this using HTML like we've just done, or you can print directly using graphics methods (as the CodeProject example I linked to) which is much more complex, or you can use Excel (which as discussed means the end-users need to have Excel installed), or you can come up with any number of other methods. Unless you know for sure that your end users have Excel it is best not to use it.
Let me tell about myself sir........
I am a final year engg. stdnt.......
I am new to vb as well as the .net......
I know C,C++,JAVA,LINUX and A little SQl
may i know how old r u sir and r u a .net professional?
My age is a little under 40, graduated in 1992 and been developing in Visual Basic for over 15 years.
Am I a .net professional? Well technically I'm a project manager/development manager, however I still do a lot of hands on coding (primarily VB.Net but some C#)
-
Jul 19th, 2009, 02:55 PM
#131
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Can you tell how to add the cells surrounding this?
-
Jul 19th, 2009, 02:58 PM
#132
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
I am an struggling engineer sir.......ad you can see no new jobs.....now a days.....
Is learning .net going to help me in my future or i should stick with the advanced Java?
I learnt a lot of things but i am not the master of any of the subjects i mentioned above......
At this stage sir what should i do.........Please suggest me as my guardian sir.....
-
Jul 19th, 2009, 02:59 PM
#133
Re: Printing problem........Need some help
Can you give me some html tags that will help me to design the printed page?
To make the headers bold you can change
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana")
swrOutput.WriteLine("}")
to
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana; font-weight:bold")
swrOutput.WriteLine("}")
-
Jul 19th, 2009, 03:02 PM
#134
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Attachment 72087
One important question sir.....
Hoe=w to increase the space between the columns.......i.e,
between the "Name","Address" and "Roll"?
Last edited by gautamshaw; Feb 21st, 2010 at 01:22 PM.
-
Jul 19th, 2009, 03:04 PM
#135
Re: Printing problem........Need some help
 Originally Posted by gautamshaw
Can you tell how to add the cells surrounding this?
You can change the code :
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana; font-weight:bold")
swrOutput.WriteLine("}")
To
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana; font-weight:bold;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid")
swrOutput.WriteLine("}")
-
Jul 19th, 2009, 03:07 PM
#136
Re: Printing problem........Need some help
To increase spacing you can set the margin attributes, ie
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana; font-weight:bold; margin:5px 5px 5px 5px; ")
swrOutput.WriteLine("}")
Obviously those values can be changed (they are pixels).
You would also amend the line further down under the "td" block to have the same margin tags
There is a good CSS tutorial here.
-
Jul 19th, 2009, 03:09 PM
#137
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana; font-weight:bold;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid")
swrOutput.WriteLine("}")
A bit shorten the width of the cells....
Attachment 72088
Where i need to make the change?
Last edited by gautamshaw; Feb 21st, 2010 at 01:22 PM.
-
Jul 19th, 2009, 03:11 PM
#138
Re: Printing problem........Need some help
I am an struggling engineer sir.......ad you can see no new jobs.....now a days.....
Is learning .net going to help me in my future or i should stick with the advanced Java?
As for this - I can't really give careers advice... the economy in the UK is very poor at the moment and there are very few jobs around, and I suspect its the same in a lot of places around the world.
My gut feel is that as a fresh graduate no-one will expect you to be a total master of any technology so it wouldn't hurt to learn .Net as well. In the UK there is a definite growth in C# at the expense of .Net but if you learn the framework well using VB you will find it easy enough to learn C#.
You might want to address this question to the general development topics forum.
Last edited by keystone_paul; Jul 19th, 2009 at 03:19 PM.
-
Jul 19th, 2009, 03:11 PM
#139
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
One important question sir............
I dont hve a printer attached to my computer.......
then how can i be sure that when i attach it.....then also no exception will be thrown and i will get the correct printed output?
-
Jul 19th, 2009, 03:13 PM
#140
Re: Printing problem........Need some help
 Originally Posted by gautamshaw
Code:
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana; font-weight:bold;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid")
swrOutput.WriteLine("}")
A bit shorten the width of the cells....
Attachment 72088
Where i need to make the change?
You can set the border width like this :
Code:
swrOutput.WriteLine("border-style:solid; border-width:1px;")
Again you can set that value to whatever you like
-
Jul 19th, 2009, 03:15 PM
#141
Re: Printing problem........Need some help
 Originally Posted by gautamshaw
One important question sir............
I dont hve a printer attached to my computer.......
then how can i be sure that when i attach it.....then also no exception will be thrown and i will get the correct printed output?
You can't ever be 100% sure until you try it, however there is nothing particularly fancy going on so if it works with your pseudo-printer driver it should work with a proper printer.
-
Jul 19th, 2009, 03:21 PM
#142
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
In this code sir
Code:
swrOutput = New StreamWriter(sPath)
swrOutput.WriteLine("<head>")
swrOutput.WriteLine("<title>Your Title Here</title>")
swrOutput.WriteLine("</head>")
swrOutput.WriteLine("<style type='text/css'>")
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 12pt verdana;font-weight:bold; margin:10px 10px 10px 10px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid;border-width:1px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("tr")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana")
swrOutput.WriteLine("}")
swrOutput.WriteLine("</style>")
swrOutput.WriteLine("<body>")
swrOutput.WriteLine("<table>")
where should i modify to increase the spacing between the columns?
Last edited by gautamshaw; Feb 21st, 2010 at 01:22 PM.
-
Jul 19th, 2009, 03:23 PM
#143
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Now sir how to add an image at the top of this page?
Can you tell this to me?
-
Jul 19th, 2009, 03:30 PM
#144
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Attachment 72090
In the design sir you can see the last name ofthe gridview the name is not coming full..........
what should i do to see the full name in the gridview when it runs?
Last edited by gautamshaw; Feb 21st, 2010 at 01:22 PM.
-
Jul 19th, 2009, 03:31 PM
#145
Re: Printing problem........Need some help
If you want the image at the top of the page rather than a watermark you need to insert some HTML :
Code:
swrOutput = New StreamWriter(sPath)
swrOutput.WriteLine("<head>")
swrOutput.WriteLine("<title>Your Title Here</title>")
swrOutput.WriteLine("</head>")
swrOutput.WriteLine("<style type='text/css'>")
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 12pt verdana;font-weight:bold; margin:10px 10px 10px 10px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid;border-width:1px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("tr")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana")
swrOutput.WriteLine("}")
swrOutput.WriteLine("</style>")
swrOutput.WriteLine("<body>")
swrOutput.WriteLine("<img src='myimage.png'>")
swrOutput.WriteLine("<table>")
Obviously you can mess around with border styles etc using standard HTML attributes.
If you want a genuine watermark behind the table I think I explained that about 150 posts ago!
-
Jul 19th, 2009, 03:38 PM
#146
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Code:
xlWorkSheet.Shapes.AddTextEffect(PresetTextEffect:=3, _
Text:="Goutam", FontName:="Arial Green", FontSize:=50, _
FontBold:=False, FontItalic:=False, Left:=150, Top:=0).Select()
For watermark sir,I think the above code that you gave wont work here......
What to do with that xlWorkSheet part sir?
Then what will be the code here?
-
Jul 19th, 2009, 03:43 PM
#147
Re: Printing problem........Need some help
OK I exaggerated - it was only 95 or so posts back. See post #52
-
Jul 19th, 2009, 03:48 PM
#148
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Code:
swrOutput = New StreamWriter(sPath)
swrOutput.WriteLine("<head>")
swrOutput.WriteLine("<title>Your Title Here</title>")
swrOutput.WriteLine("</head>")
swrOutput.WriteLine("<style type='text/css'>")
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 12pt verdana;font-weight:bold; margin:10px 10px 10px 10px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid;border-width:1px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("tr")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana")
swrOutput.WriteLine("}")
swrOutput.WriteLine("</style>")
swrOutput.WriteLine("<body>")
'swrOutput.WriteLine("<img src='D:\Project\Untitled_Title.jpg'>")
swrOutput.WriteLine("<table style='background-image: url(""D:\Project\Untitled_Title.jpg"")'>")
swrOutput.WriteLine("<table>")
I did this sir ..........
Nothing appeared..........
-
Jul 19th, 2009, 03:51 PM
#149
Re: Printing problem........Need some help
you have inserted a new table tag - you need the delete the line following your new line.
-
Jul 19th, 2009, 03:55 PM
#150
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
still its not coming sir........
I did this:
Code:
'establish a temporary filename
sPath = Path.GetTempFileName
swrOutput = New StreamWriter(sPath)
swrOutput.WriteLine("<head>")
swrOutput.WriteLine("<title>Your Title Here</title>")
swrOutput.WriteLine("</head>")
swrOutput.WriteLine("<style type='text/css'>")
swrOutput.WriteLine("th")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 12pt verdana;font-weight:bold; margin:10px 10px 10px 10px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("td")
swrOutput.WriteLine("{")
swrOutput.WriteLine("border-style:solid;border-width:1px;")
swrOutput.WriteLine("}")
swrOutput.WriteLine("tr")
swrOutput.WriteLine("{")
swrOutput.WriteLine("font: 8pt verdana")
swrOutput.WriteLine("}")
swrOutput.WriteLine("</style>")
swrOutput.WriteLine("<body>")
'swrOutput.WriteLine("<img src='D:\Project\Untitled_Title.jpg'>")
swrOutput.WriteLine("<table style='background-image: url(""D:\Project\Untitled_Title.jpg"")'>")
'swrOutput.WriteLine("<table>")
-
Jul 19th, 2009, 03:57 PM
#151
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
I have heard that the image button in asp dot net cant load an image over the 4mb size........
though i ve nt tried it yet....
Is it correct?
-
Jul 19th, 2009, 04:06 PM
#152
Thread Starter
Frenzied Member
Re: Printing problem........Need some help
Thank you sir once again for the help...........or i would have been dead......
-
Jul 19th, 2009, 04:11 PM
#153
Re: Printing problem........Need some help
 Originally Posted by gautamshaw
I have heard that the image button in asp dot net cant load an image over the 4mb size........
though i ve nt tried it yet....
Is it correct?
I don't know whether thats true off the top of my head... but why would you want an image of > 4mb for a watermark anyway? You should really just have a simple monochrome image - shouldnt be more than 10-20kb
-
Jul 19th, 2009, 04:20 PM
#154
Re: Printing problem........Need some help
If it is not working with a decent sized image you could try using
Code:
swrOutput.WriteLine("<table background='D:\Project\Untitled_Title.jpg'>")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|