excel sheet problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yogarajan
    New Member
    • Apr 2007
    • 115

    excel sheet problem

    hi i had xls template in server and write some value show to the client browser. if i click save (file -> save) button . it is save in server but i need save in client location

    here is my code

    <----Code start here --->


    SqlConnection db_con = new SqlConnection(" Data Source=192.168. 0.10;Initial Catalog=test; User Id=sa; Password=");
    db_con.Open();

    //Excel.Applicati on objExl = new Excel.Applicati onClass();
    Excel.Applicati on objExl = new Excel.Applicati on();
    string excelfilepath = Server.MapPath( ".")+"/ExcelReport/sampleReport.xl s";


    //Excel.Workbook ExlWrBk = objExl.Workbook s.Open(@"\\192. 168.50.252\soft ware\_Common\ma nju" + @"\sampleReport .xls", 0, false, 5, "", "", false, Excel.XlPlatfor m.xlWindows, "", true, false, 0, true, false, false);
    Excel.Workbook ExlWrBk = objExl.Workbook s.Open(excelfil epath, 0, false, 5, "", "", false, Excel.XlPlatfor m.xlWindows, "", true, false, 0, true, false, false);
    Excel.Sheets ExlShts = ExlWrBk.Workshe ets;

    Excel.Worksheet objWrSht = (Excel.Workshee t)ExlShts.get_I tem("sampleRepo rt");

    Excel.Range ExlRng = (Excel.Range)ob jWrSht.get_Rang e("A1", "A1");


    SqlCommand cmd = new SqlCommand("sel ect * from customermaster" , db_con);

    //SqlDataReader dr = null;
    SqlDataReader dr5 = cmd.ExecuteRead er();

    DataSet ds = new DataSet();




    int Row = 2;


    while(dr5.Read( ))

    {

    objWrSht.Cells[Row, 1] = "1";

    objWrSht.Cells[Row, 2] = dr5["cusname"];//ds.Tables[0].Columns["cusName"];

    objWrSht.Cells[Row, 3] = dr5["cusCompnay "];

    objWrSht.Cells[Row, 4] = dr5["cusindustr y"];

    objWrSht.Cells[Row, 5] = dr5["cusdesig"];

    objWrSht.Cells[Row, 6] = dr5["cusaddress 1"];

    objWrSht.Cells[Row, 7] = dr5["cusaddress 2"];

    objWrSht.Cells[Row, 8] = dr5["cuscity"];

    objWrSht.Cells[Row, 9] = dr5["cuspincode "];

    objWrSht.Cells[Row, 10] = dr5["cusmobilen o"];

    objWrSht.Cells[Row, 11] = dr5["cusLandLin eNo"];

    objWrSht.Cells[Row, 12] = dr5["cusEmail"];

    objWrSht.Cells[Row, 13] = dr5["cusinteres ton"];

    objWrSht.Cells[Row, 14] = dr5["cusinterestlev el"];

    objWrSht.Cells[Row, 15] = dr5["cusdatelastmet "];

    objWrSht.Cells[Row, 16] = dr5["cusnextmeeting date"];

    objWrSht.Cells[Row, 17] = dr5["cusFollowupsta tus"];


    Row = Row + 1;

    }
    objExl.Visible = true;

    <-----Code End here--->


    pls response immd Asap

    Thanks
  • yogarajan
    New Member
    • Apr 2007
    • 115

    #2
    hi All

    i have one more doubt

    my program is working fine in local. but it is not working in server

    why?

    pls response immd

    Thanks

    Yogarajan.G

    Comment

    Working...