1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| object oMissing= System.Reflection.Missing.Value;
Excel.Application appXls = new Excel.ApplicationClass();
appXls.Visible = false;
StatusBarAccess.Executing = "Exportation de la liste des devis vers Excel en cours...";
//Excel._Workbook Classeur = appXls.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
string filename = @"c:\VlvDevis\Export.xlt";
Excel._Workbook Classeur = appXls.Workbooks.Open(filename, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
Excel._Worksheet Feuille = (Excel._Worksheet) Classeur.ActiveSheet;
oConn=new System.Data.OleDb.OleDbConnection();
oConn.ConnectionString=MainFrame.strConn;
oCmd=new System.Data.OleDb.OleDbCommand();
oCmd.Connection=oConn;
oCmd.CommandText=strCmd;
oConn.Open();
OleDbDataReader dr = oCmd.ExecuteReader();
int nLine=5;
int DernierMontant = -999999;
string DerniereAffaire = "DeniereAffaire";
while (dr.Read())
{
if (Convert.ToInt32(dr["Montant"]) >= DernierMontant * 0.9 && Convert.ToInt32(dr["Montant"]) <= DernierMontant * 1.1 && dr["Affaire"].ToString() == DerniereAffaire)
{
Feuille.Cells[nLine-1, 4] = "[...]";
}
else
{
... |
Partager