Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content control style properties not applied. #35

Open
agtenr opened this issue Feb 24, 2023 · 1 comment
Open

Content control style properties not applied. #35

agtenr opened this issue Feb 24, 2023 · 1 comment

Comments

@agtenr
Copy link

agtenr commented Feb 24, 2023

I have a template that has a style applied in the Content Control Properties (Heading 1). However, when the text replacements are done, the styling is not there:
image

Edit in Word

image

After the replacement:

image

Code:

// Replace standard content controls
var engine = new DefaultOpenXmlTemplateEngine();
var data = new
{
    meeting = new
    {
        title = "ICT Overleg",
        when = "24 feb. 2024",
        where = "Meeting room: Zolder"
    }
};
using var template = new TemplateDocument(wordDoc);
var src = new VariableSource(JsonConvert.SerializeObject(data));
engine.ReplaceAll(template, src);

Environment

  • .NET6
  • Console Application
@antonmihaylov
Copy link
Owner

Don't have time to fix this now, but feel free to open a PR if you see a way to solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants