Convert single doc file to pdf

前端 未结 3 1726
别那么骄傲
别那么骄傲 2021-02-06 18:43

I am using following code How do I convert Word files to PDF programmatically? to convert the doc file to pdf. but the code mentions getting all .doc files from specific directo

3条回答
  •  再見小時候
    2021-02-06 19:42

    The code is looking for all .doc files in a folder and looping through them. If you jut had the one file in the folder, it would just convert that one.

    You could change this line of code:

    FileInfo[] wordFiles = dirInfo.GetFiles("*.doc");
    

    to just look for your file, eg

    FileInfo[] wordFiles = dirInfo.GetFiles("myselectedfile.doc");
    

提交回复
热议问题