- Home
- Forum
- ASP.NET Web Forms (Classic)
- How read a cell in a spreedsheet??
How read a cell in a spreedsheet??
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
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
SIGN IN To post a reply.
9 Replies
BP
Bhuvaneswari P
Syncfusion Team
January 29, 2008 04:53 AM UTC
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
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
LF
Luis Fernando Martinez Galvez
January 30, 2008 03:35 AM UTC
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
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
BP
Bhuvaneswari P
Syncfusion Team
January 30, 2008 06:36 AM UTC
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
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
LF
Luis Fernando Martinez Galvez
February 2, 2008 03:35 AM UTC
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.
BP
Bhuvaneswari P
Syncfusion Team
February 4, 2008 07:33 AM UTC
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
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
LF
Luis Fernando Martinez Galvez
February 5, 2008 08:08 PM UTC
How can open an existing Book, close, and after open another book and close??, please I need your Help, thanks for you cooperation
BP
Bhuvaneswari P
Syncfusion Team
February 6, 2008 09:21 AM UTC
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
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
LF
Luis Fernando Martinez Galvez
February 7, 2008 03:15 AM UTC
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??
BP
Bhuvaneswari P
Syncfusion Team
February 9, 2008 08:19 AM UTC
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
SIGN IN To post a reply.
- 9 Replies
- 2 Participants
-
LF Luis Fernando Martinez Galvez
- Jan 29, 2008 03:40 AM UTC
- Feb 9, 2008 08:19 AM UTC