Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to export the excel is not called book1?
Message
 
À
20/04/2011 22:49:36
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01507874
Message ID:
01508009
Vues:
37
>but if use below code, i must offer path file , then i must save the file first........
>
>How to export the excel and not call book1, if user want to save , then save the file and default the file name call aa......
>Not save the file in direct paht first....
>
>How to change my default Workbook template?
>
>
>XL.ActiveWorkbook.SaveAs(path and name of the file, Format Of The File)
>
Offer the file name BEFORE you start the Excel.
The example is for C# (I just learn it right now :-))
using Excel = Microsoft.Office.Interop.Excel; 


SaveFileDialog dlg = new SaveFileDialog();
dlg.FileName = "YourName";
dlg.Filter = "Excel Workbooks (*.xls)|*.xls";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
   {
     Excel.Application xlAppl = new Excel.Application();
     Excel.Workbook xlWB;
     Excel.Worksheet xlSheet;
     xlAppl.Visible = true;
     xlWB = xlAppl.Workbooks.Add();
     xlWB.SaveAs(dlg.FileName);
     ....
     // Your code here
   }
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform