stonypaul
stonypaul

Reputation: 677

Set inside and outside borders on one line

Is it possible to do this on one line? dataRange.Style.Border.SetInsideBorder(XLBorderStyleValues.Thin).SetOutsideBorder(XLBorderStyleValues.Thin) isn't correct syntax

        dataRange.Style.Border.SetInsideBorder(XLBorderStyleValues.Thin)
        dataRange.Style.Border.SetOutsideBorder(XLBorderStyleValues.Thin)

Upvotes: 0

Views: 345

Answers (2)

Caius Jard
Caius Jard

Reputation: 74660

Looking at the code it seems to have some sort of fluent syntax in that SetXxxBorder returns a Style. I'd hence be interested to know if this works:

dataRange.Style.Border.SetOutsideBorder(...).Border.SetInsideBorder(...);

You also have vb.net's statement separator:

    Dim t = XLBorderStyleValues.Thin : Dim b = dataRange.Style.Border : b.InsideBorder = t : b.OutsideBorder = t

If you're using eg Thin border a lot it would reduce wordiness to declare it elsewhere (like I did with t) using a reasonably descriptive but shorter name

Upvotes: 0

user16653463
user16653463

Reputation:

Try this:

dataRange.Style.Border.SetInsideBorder(XLBorderStyleValues.Thin) : dataRange.Style.Border.SetOutsideBorder(XLBorderStyleValues.Thin)

Upvotes: 1

Related Questions