We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells with multiple font styles

Hello! I’m trying to create a table in a PDF where the cells have different font styles.

example: in a cell i want the pdf to render like, “Bob read Hello World

I’ve been trying to use TextSegments and the table has the correct information, but when rendering the pdf looks like it takes the DefaultCellTextState

my code

var content_segment1 = new TextSegment("Bob read ");
var content_segment2 = new TextSegment("Hello World")
    TextState = new TextState() { FontStyle = FontStyles.Bold, ForegroundColor = Color.Beige, FontSize = 20, Font = FontRepository.FindFont("Arial-Bold") }
var content_fragment = new TextFragment();

row.Cells.Add(new Cell()
    Paragraphs = { content_fragment }


Would you kindly share the code snippet that you are using to set the DefaulTextState. We will test the scenario accordingly and share our feedback with you.

Thanks for your quick reply!

var pdf_table = new Table();
pdf_table.DefaultCellTextState = new TextState()
    FontSize = 10,
    FontStyle = FontStyles.Regular,
    Font = FontRepository.FindFont("Arial"),
    LineSpacing = 1.0f,
    HorizontalAlignment = HorizontalAlignment.Left


Thanks for sharing the requested code.

We were able to notice the issue in our environment and logged it as PDFNET-47843 in our issue tracking system. We will further look into details of it and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Awesome :slight_smile: Thanks! I look forward to the fix!