-
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?
-
Re: Printing problem........Need some help
Looks good to me. I'd suggest trying it...
-
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?
-
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?
-
Re: Printing problem........Need some help
ya i know HTML sir......
But not the css
-
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?
-
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?
-
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.
-
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?
-
Re: Printing problem........Need some help
Quote:
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.
Quote:
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#)
-
Re: Printing problem........Need some help
Can you tell how to add the cells surrounding this?
-
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.....
-
Re: Printing problem........Need some help
Quote:
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("}")
-
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"?
-
Re: Printing problem........Need some help
Quote:
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("}")
-
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.
-
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?
-
Re: Printing problem........Need some help
Quote:
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.
-
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?
-
Re: Printing problem........Need some help
Quote:
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
-
Re: Printing problem........Need some help
Quote:
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.
-
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?
-
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?
-
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?
-
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!
-
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?
-
Re: Printing problem........Need some help
OK I exaggerated - it was only 95 or so posts back. See post #52
-
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..........
-
Re: Printing problem........Need some help
you have inserted a new table tag - you need the delete the line following your new line.
-
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>")
-
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?
-
Re: Printing problem........Need some help
Thank you sir once again for the help...........or i would have been dead......
-
Re: Printing problem........Need some help
Quote:
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
-
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'>")