We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

XlsIO & Calculate using 4.2.0.37

Thread ID:

Created:

Updated:

Platform:

Replies:

46685 Jul 18,2006 05:10 PM UTC Jul 19,2006 12:24 AM UTC Windows Forms 1
loading
Tags: Calculate
Andrew Smith
Asked On July 18, 2006 05:10 PM UTC

What follows encapsulates what I want to do with a combination of XlsIO & Calculate. Needless to say it doesn''t work. Please can you review the code below and provide me with a working sample that does what I''m trying to do? Posted here because DirectTrac seems to be broken... Rgds Andy public void A002_Test_Calc_Simple001() { ExcelEngine xlEngine = new ExcelEngine(); IApplication iApp = xlEngine.Excel; xlEngine.ThrowNotSavedOnDestroy = false; IWorkbook iWB; iWB = iApp.Workbooks.Open(sshtFolder+"simple001.xls"); IWorksheet iWS = iWB.Worksheets["Main"]; // assign new values to input range iWS.Range["Input"].Value2 = new double[] {1,2,3,4,5,6,7,8}; // assign worksheet to calcsheet... myCalcSheet[] sheets = new myCalcSheet[1]; sheets[0] = new myCalcSheet(iWS); sheets[0].Name = iWB.Worksheets[i].Name; Hashtable ranges = new Hashtable(); foreach(IName name in iWS.Names) { ranges.Add(name.Name.ToUpper(), name.Value.Replace("''", "")); } CalcWorkbook cWB = new CalcWorkbook(sheets, ranges); cWB.Engine.LockDependencies = false; cWB.CalculateAll(); cWB.Engine.LockDependencies = true; // get the result double res = iWS.Range["Output"].Value2; // do it again.... iWS.Range["Input"].Value2 = new double[] {11,12,13,14,15,16,17,18}; cWB.Engine.LockDependencies = false; cWB.CalculateAll(); cWB.Engine.LockDependencies = true; // get the result res = iWS.Range["Output"].Value2; } public class myCalcSheet : CalcSheet { IWorksheet ssht; public myCalcSheet(IWorksheet sheet) { ssht = sheet; } }

Administrator [Syncfusion]
Replied On July 19, 2006 12:24 AM UTC

XlsIO does not currently support directly assigning arrays to ranges. However, it does support importing arrays by specifying first row and first column. Here is a code snippet: int[] arrTest = new int[] { 1, 2, 3, 4, 5 }; //Importing the array to sheet at the specified location. sheet.ImportArray( arrTest,int firstRow,int

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;