如何从文件夹加载和转换多个XML文件? [英] How do I load and convert multiple XML files from a folder?
问题描述
您好,
我正在使用C#Windows Forms创建应用程序,我遇到以下问题:
我在一个文件夹中有许多XML文件,我想转换所有XML文件(具有一定的名称),假设任何以Sample ***。XML开头或包含的XML文件。
现在,将导入所有以Sample开头或包含Sample的XML文件,它将分别将每个XML转换为单独的PDF格式。
我相信我必须使用SDK进行转换,但是如何以上述方式导入所有XML文件?
请帮忙。
问候
Aman Chaurasia
我有什么尝试过:
我可以从给定路径手动导入XML,但我不希望这样。
Hello,
I am creating an application in C# Windows Forms and I am having the following issue:
I have a number of XML files in a folder and I want to convert all the XML files (having a certain name) say suppose any XML file starting with or containing "Sample***.XML).
Now, all the XML files starting with or containing "Sample" will be imported and it will individually convert each XML in separate PDFs.
I believe I have to use a SDK for the conversion, but how do I import all the XML files in the mentioned manner?
Please help.
Regards
Aman Chaurasia
What I have tried:
I can import an XML manually from a given path but I don't want that.
推荐答案
使用DirectoryInfo.GetFiles根据文件名访问文件。
https://msdn.microsoft.com/en-us/library/4cyf24ss (v = vs.110).aspx
Use DirectoryInfo.GetFiles to access files based on filename.
https://msdn.microsoft.com/en-us/library/4cyf24ss(v=vs.110).aspx
Directory.GetFiles(Your_Path,Sample *)
Directory.GetFiles("Your_Path", "Sample*")
这篇关于如何从文件夹加载和转换多个XML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!