public void OpenExcelFile(string filename) { bool ret; string newfilepath; newfilepath = pathname + filename; //Open try { //ret = FpSpread1.OpenExcel(@"\\192.168.198.8\c$\Web Projeleri\diler\diler.Web\Documents\alyajlar.xls"); //ret = FpSpread1.OpenExcel(@"\\WEBSERVER2\Documents\Documents\alyajlar.xls"); ret = FpSpread1.OpenExcel("http:\\192.168.198.8\\Documents\\alyajlar.xls"); if (ret == false) { //Error opening file //Label2.ForeColor = Color.Red; //Label2.Text = "PROBLEM: Could not open file - " + newfilepath; } } catch (Exception ex) { string c = ex.Message; //Label2.ForeColor = Color.Red; //Label2.Text = ex.Message.ToString(); } }
protected void Button4_Click(object sender, EventArgs e) { string excelFilePath = @"\\192.168.198.8\Documents\alyajlar.xlsx"; System.IO.FileInfo file = new System.IO.FileInfo(excelFilePath); if (file.Exists) { FarPoint.Web.Spread.FpSpread fpSpread1 = new FarPoint.Web.Spread.FpSpread(); FarPoint.Web.Spread.SheetView shv = new FarPoint.Web.Spread.SheetView(); Controls.Add(fpSpread1); // fpSpread1.Sheets.Add(shv); string fileName; fileName = excelFilePath; //fpSpread1.OpenExcel(fileName); //FpSpread1.OpenExcel(fileName, FarPoint.Excel.ExcelOpenFlags.NoFlagsSet); FpSpread1.OpenExcel(@"\\192.168.198.8\Documents\alyajlar.xlsx", FarPoint.Excel.ExcelOpenFlags.NoFlagsSet); FpSpread1.ActiveSheetView.PageSize = FpSpread1.Rows.Count; } else { MessageBox.Show("Yuklenecek Dosyayı Seçin...", MessageBox.MesajTipleri.Error, false, 5); } //if (FileUpload1.PostedFile.FileName != "") //{ // try // { // appdirname = Request.ApplicationPath; // pathname = HttpContext.Current.Server.MapPath(Request.ApplicationPath); // OpenExcelFile("Documents\\"+ FileUpload1.PostedFile.FileName); // FpSpread1.Sheets[0].PageSize = 20; // FpSpread1.Sheets[0].AllowPage = false; // } // catch (IOException ex) // { // // Label1.Text = "dosya yok"; // } //} // else //{ // MessageBox.Show("Yuklenecek Dosyayı Seçin...", MessageBox.MesajTipleri.Error, false, 5); //} }