Friday, November 26, 2010

Convert XSL file to XLSX file using C# .net

the below code is just on your Upload control event

Code Starts--->


/*User control name */  CutomerFileUpload.SaveAs("C:\\Temp.xls");
//here use can add reference for Excel library by--> Project tab --> add reference --> com tab then add
" Microsoft Excel 12.0 Object Library component "


Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.Visible = false;

Microsoft.Office.Interop.Excel.Workbook eWorkbook = excelApp.Workbooks.Open("C:\\Temp.xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

eWorkbook.SaveAs("C:\\Temp2.xlsx", Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

eWorkbook.Close(false, Type.Missing, Type.Missing);

//Finish


Enjoyyyyyyyyyyyyyyyyyyyyyy

20 comments:

  1. I use Aspose.Cells for .NET Component for converting XLS file to XLSX , it gives great result and i also use this component to edit my excel files.

    ReplyDelete
  2. excellent article..saved me a lot of time

    ReplyDelete
  3. i want a link to download, can i search from...

    ReplyDelete
  4. The code is excellent thank you very much you helped me make to solve my problem

    ReplyDelete
  5. Hi admin, i went through article. As we all know, .net is most popular programming language and it offer huge career prospects for talented professionals. It’s totally awesome, keep on updating your blog with such awesome information. .Net Training in Chennai

    ReplyDelete
  6. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    Best RPA Training in Chennai

    Best RPA Training in Bangalore

    ReplyDelete
  7. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    Hadoop Training in Chennai

    ReplyDelete

  8. It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.

    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training
    Selenium training in bangalore

    ReplyDelete
  9. I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll.
    python training in rajajinagar
    Python training in bangalore
    Python Online training in usa

    ReplyDelete
  10. Wonderful thanks for sharing an amazing idea. keep it...

    Softgen Infotech is the Best SAP S4 HANA Training in Bangalore located in BTM Layout, Bangalore providing quality training with Realtime Trainers and 100% Job Assistance.

    ReplyDelete
  11. I would like to say thank you for the amazing details and concepts you are sharing in this.The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers! to read.


    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery



    ReplyDelete
  12. Download GATE IO Mt4: A Complete Solution For Your Forex Trading.

    ReplyDelete