Feeds:
Posts
Comments

Archive for the ‘AI’ Category

I had troubles with changing the font using OpenXml for a word document.

I first tried to google, but did not find a sutible solution. Then I tried the AI Copilot in Visual Studio, but it did give me a very good solution, then I turned to the AI ChatGpt, on my first try it gave me a couple of lines.

It just worked, here is the lines with a small alteration.

var runFonts = new RunFonts() { Ascii = “My Font” };

var runs = mainPart.Document.Descendants<Run>().ToList();

runs.ForEach(r =>

{

r.RunProperties = new RunProperties();

                                    r.RunProperties.Append(runFonts.CloneNode(true));

});

Read Full Post »