dotnet / Open-XML-SDK

Open XML SDK by Microsoft
https://www.nuget.org/packages/DocumentFormat.OpenXml/
MIT License
4.03k stars 547 forks source link

Documentation Request: Explain how to "Splitting up (shredding) a file into multiple files, and combining multiple files into a single file." #1764

Open catmanjan opened 3 months ago

catmanjan commented 3 months ago

Describe the API or scenario One of the first features listed in this repo is:

"Splitting up (shredding) a file into multiple files, and combining multiple files into a single file."

But I can't find any information on the internet on how to split a file into multiple files using this SDK.

Attempts Googled it

Related scenarios All these questions but no code answers:

https://stackoverflow.com/questions/43659785/openxml-word-document-split https://stackoverflow.com/questions/43659785/openxml-word-document-split https://stackoverflow.com/questions/4920532/how-to-split-a-word-document-by-section-using-c-sharp-and-the-open-xml-sdk

AlissaSabre commented 2 months ago

@catmanjan I have no objection to add a set of tutorials and/or examples for the features listed on the repo's readme (if someone would do it...), but, if you are looking for a quick solution, you can check https://github.com/OpenXmlDev/Open-Xml-PowerTools. The class DocumentBuilder provides the requested feature for WordprocessingML (docx) document and PresentationBuilder for PresentationML (pptx) document. Their source files are in the folder OpenXmlPowerTools.

Hope this helps.