Word document as a input has style defined and unused for numbering Library List level, but after cleanup and adding style into document won’t set it back.
As a used I want to keep unused style in my document so that I can apply to some of my document content.
attached here the project, explanatory document and screenshot, thank you for your assistance in advance.
https://app.box.com/s/n6p7s14pf540t6rmzsook6ver0bz3k87
@sudheer.darla
Can you please provide more details about the specific issue you are facing with the custom style and numbering library list after the Document Cleanup() method? Additionally, what version of Aspose.Words are you using?
@sudheer.darla If I understand your code currently your goal is to keep unused custom style while clearing unused built-in styles. Am I right? If so you can simply specify the appropriate CleanupOptions
instead of copying styles into a temporary document:
// Remove unused styles
CleanupOptions opt = new CleanupOptions();
opt.UnusedBuiltinStyles = true;
opt.UnusedStyles = false;
document.Cleanup();
In addition, the attached project does not contain your input and output documents. If the problem still persist, please attach your documents here for testing.
Thank you for your response, apologies the 7Zip excluded those files, attached here Input and output file, after code execution output file will be in bin folder.
Also, I tried different values for CleanupOptions and it is working,
with this code changes
CleanupOptions opt = new CleanupOptions();
opt.UnusedStyles = false;
opt.UnusedLists = false;
document.Cleanup(opt);
All explanation is similar as previously attached images.
StyleWordInput.docx (116.8 KB)
StyleWordOutput.docx (96.0 KB)
Thank you very much.
@sudheer.darla
So, have you managed to achieve what was required or do you still need our help?
Yes, it worked, no further assistance needed
1 Like