Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.vsnet.vstools.office,microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am developing an Excel application using VSTO with C#. Application consists of multiple sheets and very freuquently requires setting the formalling style for cell programatically. In doing do I have come across two main issues: 1. If I have any of the sheet protected (even with option selected "To Allow Formating Cells") within the workbook, the code which sets the cell style thorws exception suggesting one cannnot do this operation on protected sheet. 2. So to move on I made sure all the sheets are unprotected. Now I am able to set the style on Named Range which are made up of one cell. However when a name range consists of mulitple rows and columns and I want to set the style of cells in one of the column of this range, it does not see to take the new style in effect. Here is my code snipet: //I first obtain the style string String strStyle = Globals.ThisWorkbook.GetFormatString(strMsrName); //set the style of the second column cells of MsrDetails range, which consists of 10 rows and 2 columns //This code does not reflect any change in style I am applying here.. for (int k = 1; k <= this.MsrDetails.Rows.Count; k++) { Excel.Range cell = ((Excel.Range)this.MsrDetails.Cells[k, 2]); ((Excel.Style)(cell.Style)).NumberFormat = strStyle; } //However this works just fine, where ToBe value is a range made up of one cell only. ((Excel.Style)this.ToBe.Style).NumberFormat = strStyle; I will really appreciate you input. Thanks so much. Regards -Sharad |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
rates for Excel application development consultants | Excel Discussion (Misc queries) | |||
Excel Application Development Costs - Need Advice | Excel Discussion (Misc queries) | |||
EXCEL, VSTO: Fastest way to access multiple cells | Excel Programming | |||
EXCEL, VSTO: Fastest way to access multiple cells | Excel Discussion (Misc queries) | |||
Hiding Rows progamatically | Excel Programming |