Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Excel
I am creating an Excel file in an WinForm app (VS2008) in runtime. I am exporting some data into it from datagridview. After export, i would like to show this file in excel, but dont want to save anywhere. My goal is to use it as an alternative of creating report in crystal. Is it possible ?
Posted 13-Nov-12 19:21pm
Comments
Tinier at 14-Nov-12 1:37am
   
I think you need a excel spreadsheet viewer.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

//Create excel object and load it.
 m_objExcel1 = new Excel.Application();
  m_objBook1 = (Excel.Workbook)m_objExcel1.Workbooks.Open(@"\FM-temp.xls", m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt);
                    m_objSheets1 = (Excel.Sheets)m_objBook1.Worksheets;
                    m_objSheet1 = (Excel._Worksheet)(m_objSheets1.get_Item(1));
 
                  //If you add following line to the excel object it will view in the explorer.

                    m_objBook1.Application.Visible = true;
        
                  //then simply add values to the fields. You can view it while adding the values.

  Excel.Range oRangeI = (Excel.Range)m_objSheet1.get_Range("B" + i.ToString(), m_objOpt);
                        oRangeI.Value2 = f.Name;
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 271
1 OriginalGriff 253
2 nv3 60
3 Mehdi Gholam 45
4 VJ Reddy 45
0 Sergey Alexandrovich Kryukov 6,696
1 OriginalGriff 6,149
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100