Free Support Forum - aspose.com

Assign Value of one cell to other

Hello, How to assign the value of one cell to other like i want cells(1, 1).PutValue("=B1") this will give me =B1 as string and when i go to that cell and press enter i get the perfect value from B1 cell so why not in the direct case also when i do this cells(0, 1).Formula = "=B1/10" it gives me server error as invalid formula KIndly provide me the solution for the same Thanks & Regards Lakdawala Zaid

Hi,

I tested your scenario with our latest version v5.3.3 using the following code, it works absolutely fine. I have attached the output file here for your reference too.
Sample code:

Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets[0];
ws.Cells[“B1”].PutValue(100);
ws.Cells[1, 1].Formula = “=B1/10”;

wb.CalculateFormula();

MessageBox.Show(ws.Cells[“B2”].StringValue); //10 fine.

wb.Save(“e:\test2\ouputcellvaluetest.xlsx”);


Thank you.

Ya i am sorry that is working fine for me as well but i cant use cell a formula as there is a issue in your platform with ID 28365 in which i cant use cell as formula as it wont display its bas when i use OLE frame so i want to assign the value of one cell to the other without formula like

cells(1, 0).PutValue("=B1")
or
cells(1, 0).value=
"=B1"

or anything else as i need a workaround to this when till u people solve the
2836


Thanks & Regards
Lakdawala Zaid

Hi,


I am unable to find the Issue ID 28365 or 2836 in our Bug Tracking System. Can you elaborate further what issue are you talking about?

I guess you mean to say that you do not want to rely on MS Excel functionality to calculate your formula. Below is some source code for your need. Attached is my output file for your reference.

Please feel free to write back. Thank you

C# Sample Code


Workbook wb = new Workbook();

Worksheet ws = wb.Worksheets[0];

ws.Cells[“B1”].PutValue(100);

ws.Cells[“C1”].PutValue(ws.Cells[“B1”].Value);

ws.Cells[“D1”].PutValue((int)ws.Cells[“B1”].Value / 10);


wb.Save(“C:\temp\out.xlsx”);

I understand this but i have one doubt suppose i want a value from the cell for which the value i will insert after this cell for e.g

Cell(0,0)=10
cell(0,1)=cell(“B2”).value
cell(1,0)=20
cell(1,1)=30

in the above the Cell B2 i am creating on the 4th line,in this case it will not give me the value 30 but will give me nothing
this case use to work fine with formula

Cell(0,0)=10

cell(0,1).Formula = “=B1”

cell(1,0)=20

cell(1,1)=30

But i cant use formula and about issue 28365 your executive Mudassir Fayyaz send me the number u can check this link please
Ole frame doesnt work when cells haing Formula

Thanks & Regards
Lakdawala Zaid

Hi Zaid,


Thank you for providing us the link to the post related to issue 28365. I have studied your problem from the post link that you provided, but I am afraid I was unable to check the status of the issue. Because this issue has been logged under Aspose.Slides Product and it is beyond my scope of work.

As you have mentioned, there are certain circumstances where you have to depend upon the functionality of Excel Formula. Please use the latest assembly of Aspose.Cells for .NET v5.3.3.6 that I have attached with my reply and make use of Excel Formula in your application.

Waiting for your results.

Hello,
i have used the latest dll 6.0.0 of aspose.cells and still that issue exist
this issue is taking my head off i am not getting the proper solution for it neither from cells team not from slides team
Kindly communicate with the concern person and provide me at least some work around.


Thanks & Regards
Lakdawala Zaid

Hi Zaid,


I have tested your Aspose.Cells related code from the post below,
<a href="

As far as Aspsoe.Cells is concerned, I didn’t find any problem executing your code. Even the formula “=IF(1=0,0,0.6)” is working fine if you save the workbook to disk. I have attached my sample project with my reply for your reference.

To know the status on your logged issue 28365, can you please post an inquiry on the same thread?