Skip to content

Segment Styles are ignored when inserted inside a TextFragment #63

@Reddy-192

Description

@Reddy-192

Describe the bug
The text styles of the segments inserted inside a text fragment are ignored in rendering

To Reproduce
Create N segments, define different text styles between them, insert them in one TextFragment and render it.

Expected behavior
The styles for each segment is respected

Screenshots
image
image

using var doc = new Document();

using var page = doc.Pages.Add();

TabStops ts = new TabStops();


TabStop ts1 = ts.Add(0);
ts1.AlignmentType = TabAlignmentType.Left;
ts1.LeaderType = TabLeaderType.None;

TabStop ts2 = ts.Add(70);
ts2.AlignmentType = TabAlignmentType.Left;
ts2.LeaderType = TabLeaderType.None;

TabStop ts3 = ts.Add(220);
ts3.AlignmentType = TabAlignmentType.Left;
ts3.LeaderType = TabLeaderType.None;

TabStop ts4 = ts.Add(290);
ts4.AlignmentType = TabAlignmentType.Left;
ts4.LeaderType = TabLeaderType.None;
var segm = new[] {
	new[]{"First", "Second", "third", "fourth"},
	new[]{"First", "Second"},
};
foreach (var i in segm)
{
	TextFragment text0 = new TextFragment(ts);
	text0.HorizontalAlignment = HorizontalAlignment.Left;
	var jj = true;
	foreach (var x in i)
	{
		var seg = new TextSegment(x + "#$TAB");
		seg.TextState = new TextState()
		{
			FontStyle = jj ? FontStyles.Bold : FontStyles.Regular,
			FontSize = jj ? 15 : 8,
		};
		jj = jj != true;
		text0.Segments.Add(seg);
	}
	page.Paragraphs.Add(text0);
}

doc.Save("C:\\InvoiceTest34.pdf");

Additional context
Aspose.PDF v 24.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions