Hi,
This is my first post on these forums and I am very new to c# and .Net, so please be gentle:)
I have an ASP application that is supposed to put data into a workbook and then save it and open it in the browser later on. The program seems to hang on the SaveAs(..) line, it sort of loads and loads and loads and nothing happens. Sometimes it eventually loads the start page of the application (session time out maybe?).
I was thinking that it might be something with permissions, but everything seems to be in place as far as i understand. This used to work 1-2 months ago, but we've recently installed MS Office 2007 on the server (we had 2003 before).
Any kind of ideas are appreciated, since i don't even know what to test anymore. An error message would have made things easier but i don't understand why i don't get one...
This is the code I have: -
Excel.Application excelApp = new Excel.Application();
-
excelApp.Visible = false;
-
-
System.Globalization.CultureInfo oldCI = System.Threading.Thread.CurrentThread.CurrentCulture ;
-
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
-
-
excelApp.DisplayAlerts = false;
-
Excel.Workbook eWorkbook = excelApp.Workbooks.Open(templateFolder+c.prodCode+".xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
-
-
this.fillTechDetails(eWorkbook, ds, c, templateFolder);
-
this.fillTermsAndConditions(eWorkbook, c);
-
-
eWorkbook.SaveAs(fileFolder+c.ID+c.revision+".xls", Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
Thanks in advance!
//Anna
3 31247
Welcome to TSDN. Suggest opening file in word 2007 to see if there is a problem. If it starts loading unlikely to be permissions. You say you are using ASP this may be the problem, try updating the code. HTH.
Thank you for you reply!
I have now managed to solve this problem by changing this - eWorkbook.SaveAs(fileFolder + c.ID + c.revision + ".xls", Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
to this: - eWorkbook.SaveAs(fileFolder + c.ID + c.revision + ".xls", Excel.XlFileFormat.xlXMLSpreadsheet, Type.Missing, Type.Missing, false, false, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
I'm not sure why it worked but it worked! :)
Welcome to TSDN. Suggest opening file in word 2007 to see if there is a problem. If it starts loading unlikely to be permissions. You say you are using ASP this may be the problem, try updating the code. HTH.
Well Thanks ......
This helped me a lot. I was also having the same issue.
Majid
------------------------------------------------------------------------------------- @girlswannahavefun Sign in to post your reply or Sign up for a free account.
Similar topics
by: Geert-Pieter Hof |
last post by:
Hello,
My VB 6.0 application read and writes data from and to a MS Excel workbook,
using the Microsoft.Jet.OLEDB.4.0 provider.
Now I want to protect the Excel workbook with a password, but I...
|
by: Pierre |
last post by:
Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index, object RHS).
But really don't know what this RHS is ?
Any ideas ?
Thks for help
|
by: Axel |
last post by:
Hi!
I need to convert a stream containing an Excel workbook to an Excel
..csv file but I am not really getting it to work. Just saving the
stream as abc.xls is no good so I guess I need to...
|
by: JM |
last post by:
Hi
I was wondering if anyone out there knew how to give a Excel workbook focus.
Problem is that if I go away and do work on something else e.g. E-Mail while
the C# program is dropping data into...
|
by: |
last post by:
The following code:
Private Sub ClearControls(ByVal ctrl As Control)
Dim i As Int32
For i = ctrl.Controls.Count - 1 To 0 Step -1
ClearControls(ctrl.Controls(i))
|
by: Jerry J |
last post by:
I am sending Excel reports to web clients. Excel opens in internet explorer
displaying multiple sheets. It is pretty simple to do and works well. To do
it, a client clicks a link to an ASPX page...
|
by: Iris |
last post by:
I have 8 text files (tab delimited) that I would like to import into an Excel workbook as 8 individual worksheets but I cannot find any example code on this subject. Can anyone help me please????
...
|
by: k-w |
last post by:
Hi all
In vb I do:
Dim Ex As New Excel.Application
Ex.Workbooks.Open "c:\tmp\Book1.xls"
Similar code in VC doesn't work:
|
by: =?Utf-8?B?Um9k?= |
last post by:
The applicacion sends me the next message "Method not found:
Excel._Worksheet.SaveAs (..."
I thinks that its about permissions but I do not know how to fix it.
I have the same source in two...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| | |