Đang Thực Hiện

Convert C# to Class Library to read Office Doc Properties

Need to read the Office Document Properties from Word, Excel and Powerpoint. Can use the MS code from [url removed, login to view] which works fine as below (I modified it to use an existing doc rather than creating a new one).

However, I'd like it to compile it into a DLL so it can be called by [url removed, login to view] or WinForms in both C# and [url removed, login to view] (VS2010). So you need to implement this as a class library and sort out the interface references. I beleive this is possible but I don't have the experience or time to fiddle with that right now - I get the old "oDoc is a field but is used like a type" errors on an initial standalone class. You probably know better!

Task: Convert it to a (still C#) Class Library so I can reference the compiled DLL in another project and query for the Author, Title and Manager of a standard office doc (provided as an input filepath string).

Code to adjust:

using [url removed, login to view];

using Word = [url removed, login to view];

using [url removed, login to view];

namespace FilePropertyChecker


public partial class FormMSApp : Form


public FormMSApp()




private void btnGo_Click(object sender, EventArgs e)


[url removed, login to view] oApp;

Word._Document oDoc;

//object oMissing = [url removed, login to view];

object oDocBuiltInProps;

//object oDocCustomProps;


oApp = new [url removed, login to view]();

oDoc = [url removed, login to view](@"C:\Docs\[url removed, login to view]",

ReadOnly: false, Visible: false);

//[url removed, login to view]();

////Create an instance of Microsoft Word and make it visible.

//oWord = new [url removed, login to view]();

//[url removed, login to view] = true;

////Create a new Document and get the BuiltInDocumentProperties collection.

//oDoc = [url removed, login to view](ref oMissing, ref oMissing, ref oMissing,

// ref oMissing);

oDocBuiltInProps = [url removed, login to view];

Type typeDocBuiltInProps = [url removed, login to view]();

//Get the Author property and display it.

string strIndex = "Author";

string strValue;

object oDocAuthorProp = [url removed, login to view]("Item",

[url removed, login to view] |

[url removed, login to view],

null, oDocBuiltInProps,

new object[] { strIndex });

Type typeDocAuthorProp = [url removed, login to view]();

strValue = [url removed, login to view]("Value",

[url removed, login to view] |

[url removed, login to view],

null, oDocAuthorProp,

new object[] { }).ToString();

[url removed, login to view]("The Author is: " + strValue, "Author");

//close objects...

[url removed, login to view]();




Let me know if it's possible, should only take an hour or two if so - will include this code working in WinForms proj attached to help, see what you think. Thanks, Phil

Kỹ năng: .NET, Lập trình C#, Kiến trúc phần mềm

Xem thêm: need know programming, net used, net winforms, string standard, string library, standard string, standard programming, reflection programming, public programming, programming reflection, programming library, programming errors, objects programming, library programming, need new author read, get help programming, get excel programming help, excel programming references, excel add programming, dll system programming, string programming, sharp objects, sharp object, sharp library, programming string

Về Bên Thuê:
( 2 nhận xét ) London, United Kingdom

Mã Dự Án: #1016014

Đã trao cho:


please check your pmb.

£30 GBP trong 0 ngày
(24 Đánh Giá)

5 freelancer đang chào giá trung bình £45 cho công việc này


hi,i can do it for you.thx

£50 GBP trong 1 ngày
(36 Đánh Giá)

Lets start it.

£45 GBP trong 2 ngày
(45 Đánh Giá)

please check your PMB

£50 GBP trong 1 ngày
(10 Đánh Giá)

Hi, please see PMB

£49 GBP trong 3 ngày
(2 Đánh Giá)