This is a migrated thread and some comments may be shown as answers.

BackColor for spreadsheet cells/columns/rows?

3 Answers 185 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 07 Nov 2018, 09:02 AM

I can't seem to get the back color of a cell, row or column to set programatically.

The ribbon lets me choose a back (fill) color, but nothing happens. 

I can find the 'setForeColor' method, but there isn't a 'setBackColor'. Can you confirm that this is right ?

I CAN set back colors using the Styles = good/bad/neutral from the UI.

So is the only way to set the back color to create my own CellStyle, and use that?

Is there any documentation on how to do this? Using the Visual Studio debugger makes it a very slow process of software archeology!

3 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Nov 2018, 11:16 AM
Hello, Ian, 

In order to customize the loaded worksheet, it is necessary to apply the desired style to the specific CellSelection according to the API that the RadSpreadProcessing library offers: https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/get-set-clear-properties

Here is a basic code snippet how to change the fore color for the cells in the specified selected range: 

Workbook workbook = this.radSpreadsheet1.Workbook;
Worksheet worksheet = workbook.Worksheets.First();
CellSelection selection = worksheet.Cells[0, 0, 5, 5];
selection.SetForeColor(ThemableColor.FromArgb(115, 125, 125, 125));

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ian
Top achievements
Rank 1
answered on 08 Nov 2018, 08:12 AM

Looks like there is LOTS of good stuff here  - thanks.

(would be great to have more references to, and examples of, this kind of function. I suspect most people will be using this control (instead of a real spreadsheet) because they want to manipulate it in code, so the more examples, the easier to do that. I'm finding it a bit hard to do this manipulation without any examples)

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Nov 2018, 09:17 AM
Hello, Ian, 

RadSpreadsheet utilizes the RadSpreadProcessing library. It is a part of the Document Processing and the relevant documentation is available on a separate site. If you need to manipulate a document programatically it is suitable to use the RadSpreadProcessing library. If you face any further difficulties with it, you can submit a support ticket with the Document Processing product and thus our support staff will gladly assist you.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Spreadsheet
Asked by
Ian
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Ian
Top achievements
Rank 1
Share this question
or