Page 4 of 4 FirstFirst 1234
Results 121 to 154 of 154

Thread: Printing problem........Need some help

  1. #121

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  2. #122
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    Looks good to me. I'd suggest trying it...

  3. #123

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Unhappy 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?

  4. #124
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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?

  5. #125

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Re: Printing problem........Need some help

    ya i know HTML sir......
    But not the css

  6. #126

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  7. #127

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  8. #128
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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.

  9. #129

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Smile 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.

  10. #130
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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#)

  11. #131

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Re: Printing problem........Need some help

    Can you tell how to add the cells surrounding this?

  12. #132

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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.....

  13. #133
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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("}")

  14. #134

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Smile 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.

  15. #135
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    Quote Originally Posted by gautamshaw View Post
    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("}")

  16. #136
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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.

  17. #137

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Smile 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.

  18. #138
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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.

  19. #139

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  20. #140
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    Quote Originally Posted by gautamshaw View Post
    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

  21. #141
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    Quote Originally Posted by gautamshaw View Post
    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.

  22. #142

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Question 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.

  23. #143

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  24. #144

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Smile 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.

  25. #145
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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!

  26. #146

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  27. #147
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    OK I exaggerated - it was only 95 or so posts back. See post #52

  28. #148

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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..........

  29. #149
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    you have inserted a new table tag - you need the delete the line following your new line.

  30. #150

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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>")

  31. #151

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    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?

  32. #152

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2009
    Posts
    1,103

    Re: Printing problem........Need some help

    Thank you sir once again for the help...........or i would have been dead......

  33. #153
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Printing problem........Need some help

    Quote Originally Posted by gautamshaw View Post
    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

  34. #154
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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'>")

Page 4 of 4 FirstFirst 1234

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width