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.

adjusting cell references

Thread ID:

Created:

Updated:

Platform:

Replies:

96283 Sep 2,2010 01:10 PM Sep 13,2010 07:30 AM Windows Forms 8
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 2, 2010 01:10 PM

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

Jisha Joy [Syncfusion]
Replied On September 3, 2010 07:00 AM

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


Administrator [Syncfusion]
Replied On September 3, 2010 08:12 AM

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.


Administrator [Syncfusion]
Replied On September 3, 2010 08:20 AM

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



Nirmal Raja [Syncfusion]
Replied On September 8, 2010 09:03 AM

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

Administrator [Syncfusion]
Replied On September 8, 2010 09:01 PM

Except that your modified example doesn't work.


Jisha Joy [Syncfusion]
Replied On September 9, 2010 07:08 AM

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


Administrator [Syncfusion]
Replied On September 9, 2010 01:22 PM

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?


Jisha Joy [Syncfusion]
Replied On September 13, 2010 07:30 AM

Hi Jan,

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

Regards,
Jisha


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.

;