Free Support Forum - aspose.com

Apply bold fonts (or other formattings) to a range of cells

Hello,

I am a bit confused after going over the documentation part. I read somewhere the Style is obsolete and to instead use the ApplyStyle method. So I'd like your help.

I am using v5.3.3 with .NET 4. I am passing a range of cells (say A4:N4) as parameter to a procedure where we will set Font = true (so all the cells in that range have that particular style). This is what i was doing so far -

Protected Friend Sub BoldFont(ByVal range As String)

Dim s As Style

s = objcells(range).GetStyle

s.Font.IsBold = True

objcells(range).SetStyle(s)

s = Nothing

End Sub

Is this correct? If so, when I pass a single cell as Xcel.BoldFont("A9") it works. But when I pass a range of cells as Xcel.BoldFont("A9:N9") it says I'm passing an invalid cell name. How should i correct this?

On a related question, how can i apply a custom number format (something that I'd like to pass to the function) to a cell or a range of cells?

Also, can I do the same for other styles/formattings to achieve the same result? And what's the best way to search through your documentation for a particular topic? All i can do is type what i'm searching in the Search box and it returns results from everywhere (forum, documentation, etc). Is there an easier way to drill down the documentation?

Thanks,

Sreejith

Hi,

Please see the the document:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/named-ranges.html

Check especially the sub-topic “Format Ranges…Setting Background Color and Font Attributes to a Named Range”. Please note that you will use Range.ApplyStyle(styleObject, styleFlagObject), so using this technique, you may apply all types of formatting (back/fore color, font attributes, number formattings etc.).

Thank you.
Hi,

And, for obtaining specific search results, please click on "More Search Options" link and set your desired criteria to get your desired results:
http://www.aspose.com/community/search/search-results.aspx?x=3&y=8&q=Search+Here

Thank you.