Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: Accessing table field properties such as "TextAlign" in Microsoft Access 2013

$
0
0
Much thanks to the creator and everyone who has made this project possible. It has definitely made things a lot more organized and easier when dealing with the Microsoft.Office.Interop libraries.

I have a question concerning the use of a field property. The following code would normally just work under the Microsoft.Office.Interop.Access and Microsoft.Office.Interop.Dao namespaces.
// open database

NetOffice.AccessApi.Application app = new Application()
Database db = app.DBEngine.Workspaces[0].OpenDatabase(filePath);
TableDef myTable = db.TableDefs[tableName];
Field myField = myTable.Fields["FirstName"];
Properties myProperties = myField.Properties;   //I get 39 properties for myField
Property fieldTextAlign = myProperties["TextAlign"];
var value = fieldTextAlign .Value;
Currently when I look at the Properties and Property Class in NetOffice, I get an error:
  1. base = {"Class not exists: NetOffice.AccessApi.Property"}
Microsoft intellisense shows that Properties is in the NetOffice.DAOApi namespace even though my original application object (app) belongs in the AccessApi namespace. How do I access these properties. I tried casting but could not make it work. Any help greatly appreciated.

Dun

Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>