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. General Programming
  3. C#
  4. mailing excel file from C# windows application

mailing excel file from C# windows application

Scheduled Pinned Locked Moved C#
csharphelpdatabasesysadmin
2 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.
  • A Offline
    A Offline
    aakar
    wrote on last edited by
    #1

    Hi, I am automating excel from my windows application developed using C# and saving this file having the reports obtained through a query. Then I am mailing the excel file as an attachment through the application using the system.web.mail class provided by .net. Now the mail feature works fine but when the person receives the mail, and clicks on the excel attachment to open it, he gets the following error: "abc.xls" cannot be accessed. the file may-be read only or you may be trying to access a read-only location or the server on which the document is stored may not be responding. Please help me out. Thanks in advance, Aryan.

    S 1 Reply Last reply
    0
    • A aakar

      Hi, I am automating excel from my windows application developed using C# and saving this file having the reports obtained through a query. Then I am mailing the excel file as an attachment through the application using the system.web.mail class provided by .net. Now the mail feature works fine but when the person receives the mail, and clicks on the excel attachment to open it, he gets the following error: "abc.xls" cannot be accessed. the file may-be read only or you may be trying to access a read-only location or the server on which the document is stored may not be responding. Please help me out. Thanks in advance, Aryan.

      S Offline
      S Offline
      Stephan Samuel
      wrote on last edited by
      #2

      The header on an Excel file contains a null early on, around 10 characters in. If you're sending the contents of a file as a string, it'll hit the null and consider that the end of the file and not send the rest. Take a look at the size of the received attachment: is it resonable? A completely empty Excel 2003 file is 13824 bytes, so if it's much less than that, this is probably what's happening. Post a code snippet of your attach and send call. You may be missing (or the framework may be missing) something to designate your attachment as binary. Stephan

      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