Setting mime type for excel document

后端 未结 7 1950
终归单人心
终归单人心 2020-11-22 06:34

MS Excel has the following observed MIME types:

  • application/vnd.ms-excel (official)
  • application/msexcel
  • appli
相关标签:
7条回答
  • 2020-11-22 07:19

    I am using EPPlus to generate .xlsx (OpenXML format based) excel file. For sending this excel file as attachment in email I use the following MIME type and it works fine with EPPlus generated file and opens properly in ms-outlook mail client preview.

    string mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    System.Net.Mime.ContentType contentType = null;
    if (mimeType?.Length > 0)
    {
        contentType = new System.Net.Mime.ContentType(mimeType);
    }
    
    0 讨论(0)
提交回复
热议问题