Difference between Microsoft.Jet.OleDb and Microsoft.Ace.OleDb

It’s mainly a matter of history, effectively ACE has superceded JET: Wikipedia answers your question in great detail. The most relevant sections are: With version 2007 onwards, Access includes an Office-specific version of Jet, initially called the Office Access Connectivity Engine (ACE), but which is now called the Access Database Engine. This engine is fully … Read more

How to detect installed version of MS-Office?

One way to check for the installed Office version would be to check the InstallRoot registry keys for the Office applications of interest. For example, if you would like to check whether Word 2007 is installed you should check for the presence of the following Registry key: HKLM\Software\Microsoft\Office\12.0\Word\InstallRoot::Path This entry contains the path to the … Read more

How to read data from excel file using c# [duplicate]

There is the option to use OleDB and use the Excel sheets like datatables in a database… Just an example….. string con = @”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\temp\test.xls;” + @”Extended Properties=”Excel 8.0;HDR=Yes;””; using(OleDbConnection connection = new OleDbConnection(con)) { connection.Open(); OleDbCommand command = new OleDbCommand(“select * from [Sheet1$]”, connection); using(OleDbDataReader dr = command.ExecuteReader()) { while(dr.Read()) { var row1Col0 = … Read more

Why are cookies unrecognized when a link is clicked from an external source (i.e. Excel, Word, etc…)

This is because MS Office is using Hlink.dll component to lookup if the link is Office document or something else. MS Office expect to open the document linked within documents without the aid of external browser (using Hlink.dll component of IE6). If session cookie protects website Hlink naturally is being redirected to login page and … Read more

What do elements do anyway?

Couldn’t find any official documentation (no surprise there) but according to this interesting article, those elements are injected in order to enable Word to convert the HTML back to fully compatible Word document, with everything preserved. The relevant paragraph: Microsoft added the special tags to Word’s HTML with an eye toward backward compatibility. Microsoft wanted … Read more

How to perform better document version control on Excel files and SQL schema files

The answer I have written here can be applied in this case. A tool called xls2txt can provide human-readable output from .xls files. So in short, you should put this to your .gitattributes file: *.xls diff=xls And in the .git/config: [diff “xls”] binary = true textconv = /path/to/xls2txt Of course, I’m sure you can find … Read more

Reading Excel files from C#

var fileName = string.Format(“{0}\\fileNameHere”, Directory.GetCurrentDirectory()); var connectionString = string.Format(“Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;”, fileName); var adapter = new OleDbDataAdapter(“SELECT * FROM [workSheetNameHere$]”, connectionString); var ds = new DataSet(); adapter.Fill(ds, “anyNameHere”); DataTable data = ds.Tables[“anyNameHere”]; This is what I usually use. It is a little different because I usually stick a AsEnumerable() at the edit … Read more

Where does VBA Debug.Print log to?

Where do you want to see the output? Messages being output via Debug.Print will be displayed in the immediate window which you can open by pressing Ctrl+G. You can also Activate the so called Immediate Window by clicking View -> Immediate Window on the VBE toolbar