Solved

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

Posted on 2013-10-24
5
61 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 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

696 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