DCSIMG
office - IronShay

Browse by Tags

All Tags » office (RSS)

Developing Excel Functions in C# for Excel 2010 64-Bit

[Cross-posted from http://www.ironshay.com/post/Developing-Excel-Functions-in-C-for-Excel-2010-64-Bit.aspx ] Lately I needed to write a small “add-in” for Excel that adds a function written in C# (another case of “when your 4 years of office add-in development experience comes back to haunt you”). Before going ahead with that I searched the web for a quick how-to and ran into this old but still relevant blog post by Eric Carter. I did everything Eric had described, but every time I tried to add the...
Posted by shayf | 1 comment(s)
תגים:,

Office Tip: How To Show Internal Application Dialogs

If you want to show an application dialog (for example, the "Save As" dialog) from your own code, all you have to do is (the following is a Word object model example): Application.Dialogs[ WdWordDialog .wdDialogFileSaveAs].Show( ref Type .Missing); The WdWordDialog has, I guess, all of the available dialogs one can use in Word... Use it generously! By the way, this will work with any Office application you're playing with. The differences will be the dialog enum name (and values of...
Posted by shayf | with no comments
תגים:,

Presentation, code and resources from my session at the Office User Group

First I'd like to thank everyone who attended my session at the Office User Group, it was a great fun! I'm going to write some more posts soon that will each target a specific subject from the session. So stay tuned! The files from the session: The presentation The university example code - extract the archive to C:\OfficeUGDemos and everything should work. You must have VS 2008 and .Net 3.5 installed in order to open, build and run these demos. Some Q&A from the session Q: Can I add...
Posted by shayf | with no comments

Tip: SuspendLayout and ResumeLayout in Office Applications

When you develop WinForm applications, and you want to update various UI elements, it'd be better to call Form.SuspendLayout before the updates and Form.ResumeLayout after the updates. When developing in Office environment, you don't have these methods... But it doesn't mean that you can't achieve the exact behavior! When you want to suspend the layout, execute the following line of code: Application.ScreenUpdating = false ; When you want to resume the layout, execute: Application...
Posted by shayf | with no comments
תגים:,

The Danger in Accessing Row Objects of Word Tables

Recently, our QA team has shown me an error they received while using my Word addin... The error said "Cannot access individual rows in this collection because the table has vertically merged cells" . What what what!?!?!? After investigating the problem and looking over the Internet, I've found that Word won't let you, the miserable programmer, to use any row related property when the table has vertically merged cells... I bet that when MS developers look at this post, they point...
Posted by shayf | 1 comment(s)
תגים:, ,

Creating a Toggle Button with Office 2003

Office 2007 has brought us the toggle button control, which was missing as an out-of-the-box control in Office 2003. There is a nice workaround though, and this is what I'm going to talk about on this post. A toggle button is a button that when it's clicked, it stays pressed until another click is made upon it. The most familiar toggle button I guess, is the bold button. When you're in "bold text mode", the button looks like that ==> , and when you work normally, the button...
Posted by shayf | with no comments
תגים:, ,

How to the disable background-saving and auto-recover features in Word 2003

A few days ago I was given a request to disable the automatic saving capability of Word via an addin, so the document will be saved only when the user tells it to. The solution for this is quite simple, but the names of these properties are quite tricky so I've decided to share it with you. Here is the code you need to add: // Disable the background save feature Application.Options.BackgroundSave = false ; // Disable the auto-recover feature Application.Options.SaveInterval = 0 ; Line 2 is straight...
Posted by shayf | with no comments
תגים:, ,

My Addin has changed Normal.dot? Huh?

When you develop a large Microsoft Word addin, you might get to a point when you get a message like "Normal.dot has changed, would you like to save?" when you try to close Word. I'll put it straight - your addin isn't a pure soul and it is the trouble maker... :) It can be caused by lots of lots of different things - toolbars, styles and everything that goes to the global template AKA Normal.dot.  This behavior is simple to explain - when you set something which is related...
Posted by shayf | with no comments
תגים:, ,

Poor Loading Time for Word 2003 Addin

... or When "So Long" Means Goodbye. During the last couple of weeks I've been struggling with VSTO and my code, trying to find an answer to the long duration it was taking for Word to load with my addin, which wasn't such slow and clumsy. After testing my smart document from almost every possible angle, a colleague of mine suggested to check the automatically generated code that VSTO adds to every new smart document you create. So I did. This automatically generated code lies within...
Posted by shayf | with no comments
תגים:,