?
Solved

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

Posted on 2013-10-24
5
Medium Priority
?
62 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

765 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