PortionFormatEx contains read-only properties

Hello,

as you recommended I use PortionFormatEx class that contains all formatting properties. Could you please advise me how to change the following properties that are read-only:

  • FillFormat
  • HighlightColor
  • UnderlineFillFormat
Thanks,
marxin

Hi Marxin,


Please use the sample code shared below for setting some of contents inside the mentioned properties. You may work with other properties accordingly.

PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];

int ind = slide.Shapes.AddAutoShape (ShapeTypeEx.Rectangle ,0, 0, 500, 300);
AutoShapeEx aShp = (AutoShapeEx)slide.Shapes[ind];
aShp.AddTextFrame(string.Empty);
TextFrameEx TxtFrm = aShp.TextFrame;
PortionEx por = TxtFrm.Paragraphs[0].Portions[0];
// por.HighlightColor.Color = Color.Blue;
por.FillFormat.FillType = FillTypeEx.Solid;
por.FillFormat.SolidFillColor.Color = Color.Brown;

por.IsHardUnderlineFill = NullableBool.True;
por.IsHardUnderlineLine = NullableBool.True;

por.UnderlineFillFormat.FillType = FillTypeEx.Solid;
por.UnderlineFillFormat.SolidFillColor.Color = Color.DarkCyan;

por.Text = “Welcome to Aspose.Slides”;
pres.Write(“D:\Aspose Data\PortionText.pptx”);

Many Thanks,