Solved

Opening the Excel Workbook in share-point without installing the Excel libraries in the Server

Posted on 2013-10-24
5
57 Views
Last Modified: 2015-09-07
The logic goes here:-

There is a excel template file on the server. I read this file using code i.e C#, Excel is installed on my machine and all the things works fine. When using on the Production the same scenario, as excel is not installed the following error occurs which is attached. Kindly suggest me, to overcome this solution. How to overcome this solution without installing the EXCEL on server ?
Error.JPG
0
Comment
Question by:mu3tasem
  • 3
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39596708
0
 

Author Comment

by:mu3tasem
ID: 39596840
sqlcon.ConnectionString = ConfigurationManager.ConnectionStrings["IBTSMainString"].ConnectionString;
            this.sqlcmd = new SqlCommand("", this.sqlcon);
            this.sqlad = new SqlDataAdapter(this.sqlcmd);
            if (this.ds.Tables.Contains("Project.Master"))
            {
                this.ds.Tables["Project.Master"].Clear();
            }
            UserLoggedIn = strUserId;
            this.sqlcmd.CommandText = "Project.dbspRptMaster '" + this.UserLoggedIn + "'";
            this.sqlad.Fill(this.ds, "Project.Master");
            string filename = HttpRuntime.AppDomainAppPath + @"Reports\Contract Review.xls";
            Application application = new ApplicationClass()
            {
                AutomationSecurity = MsoAutomationSecurity.msoAutomationSecurityForceDisable
            };
             
            Workbook workbook = application.Workbooks.Open(filename, 2, false, Missing.Value, Missing.Value, Missing.Value, true, Missing.Value, Missing.Value, Missing.Value, true, Missing.Value, false, Missing.Value, Missing.Value);
            Worksheet worksheet = (Worksheet)workbook.Worksheets["Header"];
            Worksheet worksheet2 = (Worksheet)workbook.Worksheets["Items"];
            Worksheet worksheet3 = (Worksheet)workbook.Worksheets["Report"];
            Worksheet worksheet4 = (Worksheet)workbook.Worksheets["Mother Pipes Required"];
            int num = Convert.ToInt32(ProjId);


Error at Application Class
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39596998
this code requires Excel to be installed. You cannot use it if you don't install it (which is not recommended on a server). This is why you should use something else like the 2 links I have provided.
0
 

Author Comment

by:mu3tasem
ID: 39603458
Mr. emoreau thanks for your comments. Is there any alternative other than that you refer above.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39603725
what kind of alternatives are you looking for? I provided a free one and a commercial one?
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question