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.

How read a cell in a spreedsheet??

Thread ID:

Created:

Updated:

Platform:

Replies:

71367 Jan 28,2008 10:40 PM Feb 9,2008 03:19 AM ASP.NET Web Forms (Classic) 9
loading
Tags: XlsIO
Luis Fernando Martinez Galvez
Asked On January 28, 2008 10:40 PM

I have a question, I am testing your evaluation version of BackOfficeXIsIO in a program developed in visual studio 2005, and i need read text from a spreedsheet of a book in excel and saved in a label, y have tested this code, of yours samples codes and don't work:
Me.TextBox1.Text = sheet.Range("A1").Comment.Text

please help me and tell me how read a text from a cell(A1) of a spreedsheet of a book in excel and save in a label of my program,I wait for your answer, many thanks



Bhuvaneswari P [Syncfusion]
Replied On January 28, 2008 11:53 PM

Hi Luis,

Thanks for evaluating Syncfusion products.

To read a text from a cell (A1) of a spreadsheet of a book in excel and saves in a label

Yes, we can read excel sheet cell value by using the value property of Range. Please referee the below code snippet to read the cell value and save in the label or Textbox.

[VB]
Dim sheet As IWorksheet = workbook.Worksheets(0)
Me.TextBox1.Text =sheet.Range("A1").Value
Me.TextBox1.Text = sheet.Range("B1").Value

Please download the sample from the below location and let us know if this helps you.

http://websamples.syncfusion.com/samples/XlsIO.Windows/P41019/main.htm


Please let me know if you have any questions.

Best Regards,
Bhuvana






Luis Fernando Martinez Galvez
Replied On January 29, 2008 10:35 PM

Many thanks for your help, I probe this code but read the formula and I need read the value of the formula for example:

Dim sheet As IWorksheet = workbook.Worksheets(0)
Me.TextBox1.Text =sheet.Range("A1").Value
Me.TextBox1.Text = sheet.Range("B1").Value

In the previous code read the formula of the cell "=registro!=O1", but I need read the value of that formula in the cell "M1234", too need read calculations of formulas for example if the formula is
"=registro!k5*registro!h5", I need read the result of formula in then cell "20.5", thanks for your help and answer


Bhuvaneswari P [Syncfusion]
Replied On January 30, 2008 01:36 AM

Hi Luis,

Thanks for the update.

How to read the value of formula in the cell

If you want to retrieve the formula value in the cell please use the FormulaNumberValue property of the range. Please refer the below code snippet

[VB]
'To read the formula cell value
Me.TextBox1.Text= sheet.Range("B1").FormulaNumberValue

'To read the formula
Me.TextBox1.Text= sheet.Range("B1").Value

Sample Reference
http://websamples.syncfusion.com/samples/XlsIO.Windows/P41049_1/main.htm

Please let me know if you have any other questions.

Best Regards,
Bhuvana




Luis Fernando Martinez Galvez
Replied On February 1, 2008 10:35 PM

Hi I have another question, I am developing a program in visual basic 2005 using the evaluation version of the backoffice essentials XLsIO, I open a excel book and later is saved with another name and information, then I need read the information calculated by the excel book saved with another name in the last spreedheet, but when I try this, read the information of the original book and not of the copy from where I need read, please tell me how open an existing book, after close and after open a new existing book, Thnaks for your help.



Bhuvaneswari P [Syncfusion]
Replied On February 4, 2008 02:33 AM

Hi Luis,

Thanks for the update.

To get the forumula cell value at runtime

Essential XlsIO does not have a calculation engine of its own but it can compute the values of formula entered during runtime using Essential Calculate. This makes it possible to get the values of formula entered using XlsIO during runtime.

Essential Calculate can be used with Essential XlsIO to compute the values of formula entered using XlsIO. Please note that you need to have Essential Calculate installed in order to run this sample

Here is the sample for your reference:

http://websamples.syncfusion.com/samples/XlsIO.Windows/P41019_2/main.htm


Please take a look into the sample browser sample to get more info regarding this.
Syncfusion\EssentialStudio\X.X.X.X\Windows\XlsIO.Windows\Samples\2.0\DataManagement\XlsIOCalcEngine\cs

Please let me know if you have any other questions.

Best Regards,
Bhuvana



Luis Fernando Martinez Galvez
Replied On February 5, 2008 03:08 PM

How can open an existing Book, close, and after open another book and close??, please I need your Help, thanks for you cooperation


Bhuvaneswari P [Syncfusion]
Replied On February 6, 2008 04:21 AM

Hi Luis,

Thanks for the update.

To open the existing workbook, close then open a another workBook

You can open existing workbook using the Open method of Workbook object. Please refer the below code snippet to do so.

[VB]

'Step 1 : Instantiate the spreadsheet creation engine.
Dim excelEngine As ExcelEngine = New ExcelEngine()
'Step 2 : Instantiate the excel application object.
Dim application As IApplication = excelEngine.Excel

'Open the existing workbook
Dim workbook As IWorkbook = application.Workbooks.Open("..\..\Book1.xls")
'The first worksheet object in the worksheets collection is accessed.
Dim sheet As IWorksheet = workbook.Worksheets(0)

'Inserting sample text into the first cell of the first worksheet.
sheet.Range("B1:N30").Text = "Hello World"

'Saving the workbook to disk.
workbook.SaveAs("Sample.xls")

'Close the workbook.
workbook.Close()
'Open the another workbook
workbook = application.Workbooks.Open("..\..\Book2.xls")

sheet = workbook.Worksheets(0)

'Saving the workbook to disk.
workbook.SaveAs("Sample1.xls")

'Close the workbook.
workbook.Close()

Please download the sample from the below location:

http://websamples.syncfusion.com/samples/XlsIO.Windows/P41019_3/main.htm


Please let me know if you need any further assistance.

Best Regards,
Bhuvana





Luis Fernando Martinez Galvez
Replied On February 6, 2008 10:15 PM

Thanks for your help, I need open an existing workbook, read some cells from an sheet, store in an label, after close the woorkbook, and open another woorkbook, read some cells from as sheet, stores in an label and close the woorbook, please help how open, read after open a new woorkbook and read from an sheet of the new woorkbook??




Bhuvaneswari P [Syncfusion]
Replied On February 9, 2008 03:19 AM


Hi Luis,

Thanks for the update.

Please download the sample from the below location for to open the excel sheet and read sheet cell value and store it in a textbox, then close open next workbook read some cell value.

http://websamples.syncfusion.com//samples/XlsIO.Windows/F71367_4/main.htm

Please let me know if you have any other question.

Best Regards,
Bhuvana



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.

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.

;