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

Free Support Forum - aspose.com

Actual style doesn't correspond with selected

Hello Aspose Team!

I have a problem with paragraph style when referencing the original document styles with builder.ParagraphFormat.Style = builder.Document.Styles["My_Custom_Style_Name"];

Acual code is:

private void AddSectionHeading(Words.DocumentBuilder builder, string name)
{
    builder.ParagraphFormat.ClearFormatting();
    builder.ParagraphFormat.Style = builder.Document.Styles[SECTION_HEADER_Style];
    builder.ParagraphFormat.StyleIdentifier = Words.StyleIdentifier.Heading1;
    builder.Writeln(name);
    builder.ParagraphFormat.ClearFormatting();
}

public void Render()
{
    builder.InsertBreak(Words.BreakType.PageBreak);
    AddSectionHeading(builder, POSTS_Name);

    builder.ParagraphFormat.Style = builder.Document.Styles[COMMON_Style];
    builder.Write(text);
}

The problem is that paragraphs in rendered document are hihglighted with used style but their font, size and lineheight is different.

@vitaminniy,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

The problem is solved. Original document was corrupted.

@vitaminniy,

it is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.