In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to use Open-Xml-PowerTools of C#". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
OpenXML is an official Microsoft open source operation Word, Excel and PPT SDK, developed with C #, using this kind of library can easily operate the three main types of office documents, and do not need to install Office programs.
Open-Xml-PowerTools is an extension of OpenXML, which is optimized and easy to use on the basis of OpenXML.
Open-Xml-PowerTools is an open source class library
According to the detailed use, list the use of this type of library to merge ppt and doc documents, the specific code is as follows:
Ppt file merge:
/ / initialize a SlideSource list of ppt
Var sources = new List ()
For (int ii = 1; ii < _ pidx; ii++)
{
/ / add the path to the ppt file
String _ tpptx = Path.Combine (_ baseOutdir, "ppt list" + ii + ".pptx")
If (File.Exists (_ tpptx))
{
/ / add a ppt document to sources, which specifies the specific pages of the ppt
Sources.Add (new OpenXmlPowerTools.SlideSource (new OpenXmlPowerTools.PmlDocument (_ tpptx), false))
}
}
/ / ppt file merge function, set the output path, and enter the previous sources list
OpenXmlPowerTools.PresentationBuilder.BuildPresentation (sources, Path.Combine (_ baseOutdir, "ppt file output" + _ pidx + ".pptx"))
Word file merge:
/ / the list of word files is sources, initialize the
Var sources = new List ()
Sources.Add (new OpenXmlPowerTools.Source (new OpenXmlPowerTools.WmlDocument (_ basePPTPath), true))
For (int ii = 1; ii < _ pidx; ii++)
{
String _ tpptx = Path.Combine (_ baseOutdir, "word" + ii + ".docx")
If (File.Exists (_ tpptx))
{
/ / add a word document to sources, which specifies the specific pages of the word
Sources.Add (new OpenXmlPowerTools.Source (new OpenXmlPowerTools.WmlDocument (_ tpptx), false))
}
}
/ / word file merge function, set the output path, and enter the previous sources list
OpenXmlPowerTools.DocumentBuilder.BuildDocument (sources, Path.Combine (_ baseOutdir, "word.docx"))
OpenXmlPowerTools needs to generate documents according to the template, is a very convenient class library, in development, you can make a good template of documents in the background, through service requests, generate documents for users to download.
This is the end of the content of "how to use Open-Xml-PowerTools of C#". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.