Is there possible to load the html tag in textframe #543
Replies: 2 comments 2 replies
-
Not really... or maybe not in the scope of this library...
Example: var html = "<p>hai, <strong> how are you?</strong></p>";
var ast = parser(html);
var renderer = new Renderer(shape.TextFrame!);
foreach (var token in ast) {
renderer.Render(token);
}
class Renderer {
void Render(T token) {
switch (token.GetType()) {
case "P": this.RenderParagraph(token)
...
}
}
void RenderParagraph(T token) {
_activeP = _textFrame.Paragraphs.Add();
}
var RenderInline(InlineToken token) {
_activeP.Portions[0].Text = token;
}
void RenderStrong(StrongToken token) { ... }
void RenderContainer(ContainerToken token) {
// recursive
foreach (var t in token) {
Render(t);
}
}
} As you can see, you will need defines types for token and specific codes for that tokens.. and after that, you will need to parse This is my only opinion 😵💫 |
Beta Was this translation helpful? Give feedback.
-
`using HtmlAgilityPack;
private void RenderBullet(ITextFrame textFrame, HtmlNode htmlNode, CustomFont customFont)
` |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Example :-
String question = "<p>Hai, <strong> how are you ? </strong></p>";
output : Hai, how are you ? // like this output need to set in ppt text frame
i dont like to use sc font property for set the font styles instead of that i would like to use the innerhtml tag
because lot of condition have to write based on html tag and then assign into scfont .
Note :- am using Rich textbox, that textbox string values are directly load into the ppt . that's why am asking
@huchim @adamshakhabov
Beta Was this translation helpful? Give feedback.
All reactions