We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Copy and Paste (Combobox)

Is it possible to copy a value from a cell containing a combobox and paste that selected value to other cells that also contain a combobox?

Also, could it be possible to have the option to isolate the copy and pasting to a row level and specify whether each row should allow it or not?

Can you let me know the feasibility of adding these features to a future release if they're not already available?

Thanks.

Hi,

Are you using GridDesktop control? I am not sure about your need. Kindly give us your requirements in detailed manner and how it is possible in MS Excel. Please provide us complete information, so, that we could check/analyze if we can support it or not.

Thank you.


Yes, I'm talking about the GridDesktop control, however it is currently version 2.0.2 I'm in the process of installing the latest version where maybe this already exists.

If not, in Excel, add 4 comboboxes using Data-Validation-Allow-List, specifying a range of cells where you've added 4 entries: 'Test 1', 'Test 2', 'Test 3', 'Test 4'.

If you then select and copy Test 1 from the first cell and then highlight the other 3 cells, you're able to paste Test 1 to the other 3 cells. When you click on any of the other 3 cells, the list is the same and Test 1 is selected.

This is what I would want to be able to do with the Aspose GridDesktop.

Hi,

"If you then select and copy Test 1 from the first cell and then
highlight the other 3 cells, you’re able to paste Test 1 to the other 3
cells. When you click on any of the other 3 cells, the list is the same
and Test 1 is selected."

This feature of Copy/Paste (right click on a cell value, click copy, now select a range of cells and click paste - this will paste the value to all the cells in the destination range) is already supported in the latest version v2.0.3.2000, please try it and let us know if it works according to your need.

Thank you.

This works for copying the selected value from a combobox and pasting it to other cells that also contain a combobox?

I'm pretty sure I just tried it using the latest version and it didn't work.

Can you provide me with a working example?

Using the code below, let me know if you're able to select Aspose from the drop-down in the 1st cell, have it actually display Aspose and then right-click and copy Aspose and paste it to the other 4 columns to the right.

//Accessing the worksheet of the Grid that is currently active

Worksheet sheet = gridDesktop1.GetActiveWorksheet();

//Accessing the location of the cell that is currently in focus

CellLocation cl = sheet.GetFocusedCellLocation();

//Creating an array of items or values that will be added to combobox

string[] items = new string[3];

items[0] = "Aspose";

items[1] = "Aspose.Grid";

items[2] = "Aspose.Grid.Desktop";

object[] values = new string[3];

values[0] = "128";

values[1] = "335";

values[2] = "747";

//Adding combobox to the Controls collection of the Worksheet

sheet.Controls.AddComboBox(0, 0, items, values);

sheet.Controls.AddComboBox(0, 1, items, values);

sheet.Controls.AddComboBox(0, 2, items, values);

sheet.Controls.AddComboBox(0, 3, items, values);

sheet.Controls.AddComboBox(0, 4, items, values);

Hi,

Thanks for the details,

We will look into it and get back to you soon.

Thank you.

Hi,

We understand your requirement now, we have logged your request into our issue tracking system with an issue id: CELLSNET-15909. We will let you know when it is sorted out.

Thank you.

Hi,

Could you try the attached version if it works fine for your requirement now.

Thank you.

Hi, I'm using v2.1.0.2004 and this isn't working.

When I copy the selected value from the combobox, it doesn't paste to the other columns that also have comboboxes.

Here's another tricky part. I wouldn't want the paste to work if the comboboxes in the cells I was pasting to didn't have the same item and value from where I copied...make sense?

One last thing, I noticed it doesn't allow me to copy a selection when I select non-contiguous rows.

Hi,

Do you want to copy the selected item/value from a Combobox and paste that item/value to other existing Combobox (adding a new item/value to the Comboxbox item/value collection? Or you want to paste that item/value to a cell as just a cell’s value? And could you tell how MS Excel performs this task?

Thanks for providing us further details.

We will check it soon.



In Excel, the combobox and selection will be copied to cell you're pasting to...pretty much overwriting any combobox currently there.

This would be fine however, it would be nice if I could make some checks before performing the copy. I wouldn't want to combobox to be copied if the cell being copied to had a combobox with a different list.

So, if there were a PreCopy event or something like that, I could check the new cell to make sure the list items and values are the same before continuing.

Hi,

We have supported copying combobox with items and values, and provided an event handler named “CellComboBoxCopy” to compare items and values for the comboboxes.

Please try the following code with Aspose.Cells.GridDesktop v2.1.1.2001 (attached).

private void gridDesktop1_CellComboBoxCopy(object sender, CellCopyComboBoxEventArgs e)

{

e.Handled = true;

<span style=“font-size: 10pt; font-family: “Courier New”;” lang=“EN-US”>
}


Thank you.