.net - How do I use PIA to open an Excel workbook and save the first sheet to a text file? -


I am not very familiar / PIA assembly for Office Interop (Office 2007) and a workbook by .NET / C # Need to open and save the first sheet as a tab delimited text file. Can anyone direct me on how to do this? Thanks!

This is a big question, but take a look at the bottom.

  [TestMethod ()] Public Zero ExcelTest () {Microsoft.Office.Interop.Excel.Application excelApplication = new application (); String file = @ "C: \ testheet.xls"; Microsoft.Office.Interop.Excel.Workbook wkb = excelApplication.Workbooks.Open (file, 0, wrong, 5, missing value, missing value, wrong, missing value, lost value, true, lie, lost value , False, false, false); Microsoft.Office.Interop.Excel.Worksheet wks = wkb.Worksheets [1] as Microsoft.Office.Interop.Excel.Worksheet; Wks.SaveAs (@ "C: \ savedFile.txt", Microsoft.Office.Interop.Excel.XlFileFormat.xlTextWindows, Type Missing, Type Missing, Type Missing, Type Missing, Type Missing, Type Missing , Type missing, type missing); }  

Remember to close the application and workbook when you are doing or at any other error.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -