Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. printing local excel file with ASP.Net

printing local excel file with ASP.Net

Scheduled Pinned Locked Moved ASP.NET
asp-netcsharpwinformstutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jszpila
    wrote on last edited by
    #1

    Hello everyone, I have an excel file in the same directory as my .aspx page and I need it to printed to the user's default printer (after whatever necessary dialogs) when a button is clicked. All the tutorials I've found are windows forms examples are pretty clunky and I'm not quite sure how to transfer them over the to context of web forms. If anyone could give me any pointers or links to examples, I would be most appreciative. Thanks in advance! ------------------- abort, retry, fail?

    I 1 Reply Last reply
    0
    • J jszpila

      Hello everyone, I have an excel file in the same directory as my .aspx page and I need it to printed to the user's default printer (after whatever necessary dialogs) when a button is clicked. All the tutorials I've found are windows forms examples are pretty clunky and I'm not quite sure how to transfer them over the to context of web forms. If anyone could give me any pointers or links to examples, I would be most appreciative. Thanks in advance! ------------------- abort, retry, fail?

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      you could maybe download the file and using Page.RegisterStartUpScript() send javascript code "window.print();" Nick 1 line of code equals many bugs. So don't write any!!

      J 1 Reply Last reply
      0
      • I Ista

        you could maybe download the file and using Page.RegisterStartUpScript() send javascript code "window.print();" Nick 1 line of code equals many bugs. So don't write any!!

        J Offline
        J Offline
        jszpila
        wrote on last edited by
        #3

        That gave me an awesome idea that worked out great. In case anyone's interested, here's what I did: 1. saved my query string as a session variable 2. added an attribute to my link button that triggered the print to open a new window 3. opened a new window that containted print.aspx on click, that did the follwing: - populated a datagrid from the query string session variable - registered a client script that: - called window.print() - called window.close() Thanks for your help! ------------------- abort, retry, fail?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups