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. Image for the cookie policy date

adjusting cell references

I have an application with two GridControls. I have initialized a GridFormulaEngine using:


static public GridFormulaEngine engine;

and


engine = ((GridFormulaCellModel)grid1.Model.CellModels["FormulaCell"]).Engine;
engine.FormulaCopyFlags |= GridFormulaCopyFlags.ClipBoardText;
engine.FormulaCopyFlags |= GridFormulaCopyFlags.ClipBoardFormula;
engine.FormulaCopyFlags |= GridFormulaCopyFlags.InsDelRangeReferencesUpdated;
engine.FormulaCopyFlags |= GridFormulaCopyFlags.ClipBoardReferencesAdjusted;
engine.FormulaCopyFlags |= GridFormulaCopyFlags.NamedRangeReferencesUpdated;

I then implemented a copy and paste function using a context menu. As long as the equations being copied only contain references to locations within the same grid, their references are updated correctly using the statement:

grid1[r, c].Text = engine.AdjustReferences(formulaString, rowOffset, colOffset);

However, if the formula references locations in another grid, it doesn't update the references.

Can anyone help me get this figured out?

For more detail, please refer to the attached project.

v/r
Jan




Estimator_41d38a25.zip

8 Replies

JJ Jisha Joy Syncfusion Team September 3, 2010 11:00 AM UTC

Hi Jan,

I have tested the issue in the provided sample. Cell references are adjusting properly while copying and pasting. Could you lease provide the reproducing steps to see the issue with the provided sample?.


Regards,
Jisha



AD Administrator Syncfusion Team September 3, 2010 12:12 PM UTC

In the sample I provided, try doing the following.

1. In the large grid in the upper right, enter the following numbers:

enter 1 in cell b2
enter 2 in cell b3
enter 3 in cell b4
enter 4 in cell c2
enter 5 in cell c3
enter 6 in cell c4

2. in the grid at the lower right enter the following formula in cell b2.

=grid!b2:b4 ('grid' is the name of the upper
gridcontrol)

This should display a 6 in cell b2 of the lower right grid.

3. Now right click on cell b2 in the lower right grid and select copy.



AD Administrator Syncfusion Team September 3, 2010 12:20 PM UTC

In the sample I provided, try doing the following.

1. In the large grid in the upper right, enter the following numbers:

enter 1 in cell b2
enter 2 in cell b3
enter 3 in cell b4
enter 4 in cell c2
enter 5 in cell c3
enter 6 in cell c4

2. in the grid at the lower right enter the following formula in cell b2.

=grid!b2:b4 ('grid' is the name of the upper
gridcontrol)

This should display a 6 in cell b2 of the lower right grid.

3. Right click on cell b2 in the lower right grid and
select copy.

4. Right click on cell c2 in the lower right grid and select
paste.

You will end up with the following formula in cell c2:

=sum(grid!B2:B4)

It needs to update the references so that it reads:

=sum(grid!c2:c4)



I was fiddling around this morning and discovered that it has something to do with the grid reference. If I enter =sum(b2:b4)
in one of the cells in the upper right grid and then copy it
to another location, it is updated properly. But if I enter
=sum(grid!b2:b4) in the upper right grid and then copy it to another location, it isn't updated properly. I hadn't realized this before because I didn't think to try it.

I hope these notes help.

v/r
Jan




NR Nirmal Raja Syncfusion Team September 8, 2010 01:03 PM UTC

Hi Jan,

Instead of using the workaround as retrieving the cells and its value to copy and paste, you can use the CutPaste object to copy and paste object.

Please refer the code below to copy and paste:
currentGrid.CutPaste.Copy();
currentGrid.CutPaste.Paste();


Also refer the modified sample attached in the below location.

Let me know if you have any concern.

Regards,
Nirmal



Estimator_c59f5ba7.zip


AD Administrator Syncfusion Team September 9, 2010 01:01 AM UTC

Except that your modified example doesn't work.



JJ Jisha Joy Syncfusion Team September 9, 2010 11:08 AM UTC

Hi Jan,

We had some issues with copy paste to grid cells in previous versions. But the issues were fixed in latest version 8.3.0.21. Please make use of our latest version with lots of fixes and advanced features. You could download the same from the following link:

http://www.syncfusion.com/downloads/latest-version


Regards,
Jisha



AD Administrator Syncfusion Team September 9, 2010 05:22 PM UTC

Unfortunately, I purchased 8.2.0.18 when you folks put in on a special sale and it didn't include support. So how am I supposed to get a key to use the corrected version?



JJ Jisha Joy Syncfusion Team September 13, 2010 11:30 AM UTC

Hi Jan,

Thank you for your update. Please contact sales@syncfusion.com for any key related queries.

Regards,
Jisha


Loader.
Live Chat Icon For mobile
Up arrow icon