Results 1 to 7 of 7

Thread: How can I print a XML file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84

    How can I print a XML file

    Hi vb-forum:

    I need some help, I know that you always have a solution; I need to print the content of a .xml file, does anybody how can I do it?, or if someone know an example code to print this kind of files?

    Thank in advance and regards.

    Angel Maldonado
    VB Developer
    Angel Maldonado López.
    VB Programmer

  2. #2
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: How can I print a XML file

    And XML File is basically a text file with certain variable parameters and their values inserted side by side... so you can print it like a normal text file in VB using the Rich Text Box control and opening the XML file and using Printer.Print RichTextBox1.Text
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How can I print a XML file

    What would you need to import it into a richtextbox first? Just send it straight to the printer like any other text file.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Function PrintTextFile(sTextFile As String) As String
    4. If Dir(sTextFile) <> vbNullString Then
    5.     Open sTextFile For Binary As #1
    6.     PrintTextFile = Input(LOF(1), 1)
    7.     Close #1
    8. End If
    9. End Function
    10.  
    11. Private Sub Command1_Click()
    12. Screen.MousePointer = vbHourglass
    13. Printer.Print PrintTextFile("d:\closedhow.xml")
    14. Printer.EndDoc
    15. Screen.MousePointer = vbDefault
    16. End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84

    Re: How can I print a XML file

    Ok:

    I need to make a format to extract and print this values or parameters that has some envoice files on .xml format, i.e. name, address, zip code, etc. if you know some process that made a print preview I glad you, taken this values I can print the report of envoices.

    Thanks and have a nice day.

    Angel M.
    Angel Maldonado López.
    VB Programmer

  5. #5
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: How can I print a XML file

    You mean in the format eg:

    Name: Jon Doe
    Address: Al Ovah
    Zip: 1234


    Cause if this is how you want to do it then you'll need to parse the XML file...
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    México, D.F.
    Posts
    84

    Re: How can I print a XML file

    Yes Protocol, I need to make a format like this, Hack I'm going to test the code.
    Angel Maldonado López.
    VB Programmer

  7. #7
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    468

    Re: How can I print a XML file

    Send it to IE (or any browser than can display XML) and print it from there.

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