locked
Writing Function in Excel file in some specific cell RRS feed

  • Question

  • User-779790070 posted

    Writing Function in some specific cell of an excel file

    I want to implement the calculation logic of excel at C#.NET and transfer the function to specific cell in excel (that is the mode of writing function will be as we do in Ms Excel. Example, if we use summation for range function then the formula we can design in C#.NET but will actually sent to worksheets cell).

    Saturday, August 6, 2011 12:46 PM

Answers

All replies

  • User-359936451 posted

    Just figureout how to create the formula in a cell of a gridview for example then export to an excel spreadsheet. There are many web links showing how to export an aspx page to Excel. Once you have the formula in the Gridview it will export to Excel.

     

     

    Saturday, August 6, 2011 2:39 PM
  • User3866881 posted

    Hello vishal_asp.net:)

    No matter which datatbase your are referring, plz use XXXDataAdapter.Fill to create a memory-based DataTable, and export to the Excel sheet.

    http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html

    For calculation, you can use something looking like "DataTable.Compute(……))" Or just use DataTable.Columns[indedx].Expression="Column1+Column2";……

    Thx again

    PS: If you are using WinForm, I'd like to recommand you directly use Office Tool's programming:http://social.msdn.microsoft.com/Forums/en-US/exceldev/threads

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2011 9:42 PM