OpenXML - Wordprocessing - Table Cell commands












0















  cell = (TableCell)cell;
Paragraph p = new Paragraph();
Run run = p.Elements<Run>().FirstOrDefault();
RunProperties runProps = new RunProperties();
Bold bold = new Bold();
runProps.Append(bold);
run.AppendChild(new RunProperties(runProps));


I have commands stored in enumeration and abstract classes mapping these commands from an abstract Cell to an OpenXml cell. These commands include: Bold, Underline, Italic, Left Align, etc. I am looking to modify the cell run without having a ChildAppend child collision error that is typically thrown when appending an invalid child. What would be the best approach? Modify the paragraph properties of the cell or the run properties?



This may just be my misunderstanding of what OpenXml looks like under the hood and which attributes are openly append-able / need to be only created once.










share|improve this question

























  • Your problem description isn't really clear - an example of "good" vs. "Bad" code might help a bit. It's also not clear what you mean by "modify the cell run" - whether you mean text and formatting or only formatting. If you want to see what Open XML looks like "under the hood", use the Open XMl SDK Productivity Tool to look at the actual XML. You can also create a document with the starting point, save it, make the kind of change you're interested in save to a different name, then use the Tool's "Compare" functionality to see how it "should" be done.

    – Cindy Meister
    Nov 20 '18 at 16:34











  • Reading the ECMA documentation might also give some insight.

    – Cindy Meister
    Nov 20 '18 at 16:34
















0















  cell = (TableCell)cell;
Paragraph p = new Paragraph();
Run run = p.Elements<Run>().FirstOrDefault();
RunProperties runProps = new RunProperties();
Bold bold = new Bold();
runProps.Append(bold);
run.AppendChild(new RunProperties(runProps));


I have commands stored in enumeration and abstract classes mapping these commands from an abstract Cell to an OpenXml cell. These commands include: Bold, Underline, Italic, Left Align, etc. I am looking to modify the cell run without having a ChildAppend child collision error that is typically thrown when appending an invalid child. What would be the best approach? Modify the paragraph properties of the cell or the run properties?



This may just be my misunderstanding of what OpenXml looks like under the hood and which attributes are openly append-able / need to be only created once.










share|improve this question

























  • Your problem description isn't really clear - an example of "good" vs. "Bad" code might help a bit. It's also not clear what you mean by "modify the cell run" - whether you mean text and formatting or only formatting. If you want to see what Open XML looks like "under the hood", use the Open XMl SDK Productivity Tool to look at the actual XML. You can also create a document with the starting point, save it, make the kind of change you're interested in save to a different name, then use the Tool's "Compare" functionality to see how it "should" be done.

    – Cindy Meister
    Nov 20 '18 at 16:34











  • Reading the ECMA documentation might also give some insight.

    – Cindy Meister
    Nov 20 '18 at 16:34














0












0








0








  cell = (TableCell)cell;
Paragraph p = new Paragraph();
Run run = p.Elements<Run>().FirstOrDefault();
RunProperties runProps = new RunProperties();
Bold bold = new Bold();
runProps.Append(bold);
run.AppendChild(new RunProperties(runProps));


I have commands stored in enumeration and abstract classes mapping these commands from an abstract Cell to an OpenXml cell. These commands include: Bold, Underline, Italic, Left Align, etc. I am looking to modify the cell run without having a ChildAppend child collision error that is typically thrown when appending an invalid child. What would be the best approach? Modify the paragraph properties of the cell or the run properties?



This may just be my misunderstanding of what OpenXml looks like under the hood and which attributes are openly append-able / need to be only created once.










share|improve this question
















  cell = (TableCell)cell;
Paragraph p = new Paragraph();
Run run = p.Elements<Run>().FirstOrDefault();
RunProperties runProps = new RunProperties();
Bold bold = new Bold();
runProps.Append(bold);
run.AppendChild(new RunProperties(runProps));


I have commands stored in enumeration and abstract classes mapping these commands from an abstract Cell to an OpenXml cell. These commands include: Bold, Underline, Italic, Left Align, etc. I am looking to modify the cell run without having a ChildAppend child collision error that is typically thrown when appending an invalid child. What would be the best approach? Modify the paragraph properties of the cell or the run properties?



This may just be my misunderstanding of what OpenXml looks like under the hood and which attributes are openly append-able / need to be only created once.







c# ms-word openxml core openxml-sdk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 16:29









Cindy Meister

14.6k102234




14.6k102234










asked Nov 20 '18 at 16:23









RobRob

106




106













  • Your problem description isn't really clear - an example of "good" vs. "Bad" code might help a bit. It's also not clear what you mean by "modify the cell run" - whether you mean text and formatting or only formatting. If you want to see what Open XML looks like "under the hood", use the Open XMl SDK Productivity Tool to look at the actual XML. You can also create a document with the starting point, save it, make the kind of change you're interested in save to a different name, then use the Tool's "Compare" functionality to see how it "should" be done.

    – Cindy Meister
    Nov 20 '18 at 16:34











  • Reading the ECMA documentation might also give some insight.

    – Cindy Meister
    Nov 20 '18 at 16:34



















  • Your problem description isn't really clear - an example of "good" vs. "Bad" code might help a bit. It's also not clear what you mean by "modify the cell run" - whether you mean text and formatting or only formatting. If you want to see what Open XML looks like "under the hood", use the Open XMl SDK Productivity Tool to look at the actual XML. You can also create a document with the starting point, save it, make the kind of change you're interested in save to a different name, then use the Tool's "Compare" functionality to see how it "should" be done.

    – Cindy Meister
    Nov 20 '18 at 16:34











  • Reading the ECMA documentation might also give some insight.

    – Cindy Meister
    Nov 20 '18 at 16:34

















Your problem description isn't really clear - an example of "good" vs. "Bad" code might help a bit. It's also not clear what you mean by "modify the cell run" - whether you mean text and formatting or only formatting. If you want to see what Open XML looks like "under the hood", use the Open XMl SDK Productivity Tool to look at the actual XML. You can also create a document with the starting point, save it, make the kind of change you're interested in save to a different name, then use the Tool's "Compare" functionality to see how it "should" be done.

– Cindy Meister
Nov 20 '18 at 16:34





Your problem description isn't really clear - an example of "good" vs. "Bad" code might help a bit. It's also not clear what you mean by "modify the cell run" - whether you mean text and formatting or only formatting. If you want to see what Open XML looks like "under the hood", use the Open XMl SDK Productivity Tool to look at the actual XML. You can also create a document with the starting point, save it, make the kind of change you're interested in save to a different name, then use the Tool's "Compare" functionality to see how it "should" be done.

– Cindy Meister
Nov 20 '18 at 16:34













Reading the ECMA documentation might also give some insight.

– Cindy Meister
Nov 20 '18 at 16:34





Reading the ECMA documentation might also give some insight.

– Cindy Meister
Nov 20 '18 at 16:34












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53397296%2fopenxml-wordprocessing-table-cell-commands%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53397296%2fopenxml-wordprocessing-table-cell-commands%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

How to fix TextFormField cause rebuild widget in Flutter