I am working on a console application that converts an xlsx file to an xls file. I do not want to rename it from xlsx to xls, because it will open in excel 2007, but it will be shown as a damaged file in excel 2003. You are looking for a way to download the document, and then it will be saved as xls format.
My current code is just renaming xlsx to xls
string fileName = @"C:\Users\L-3\Desktop\my.xlsx"; string svfileName = @"C:\Users\L-3\Desktop\ssc\my1.xls"; object oMissing = Type.Missing; var app = new Microsoft.Office.Interop.Excel.Application(); var wb = app.Workbooks.Open(fileName, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing); wb.SaveAs(svfileName, XlFileFormat.xlOpenXMLTemplate, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); app.Quit();
source share