ByRef, ByVal, COM Objects, and Excel

I’m working on getting things into and out of Excel.  In one scenario I copy an Excel Range or Rows from one Excel Worksheet to a Worksheet in another Workbook.  This Workbook then acts as a storage repository for the Range of Rows and is saved and closed.  Each of these Range of Rows are saved with a unique identifier on the row above the copied in Range of Rows.

I then want to retrieve the Range of Rows to insert back into that Workbook’s Worksheet in another location.  I have an Excel Addin that provides a dialog box.  This dialog box goes through the Workbook’s Worksheet that is acting as a repository and retrieves each Range of Rows and provides a list based on the unique name in a dialog box.  The user can then click on the unique Range of Rows unique name and the idea is then to open the Range of Rows and copy them into the Worksheet the user is actually working in.

I had created a nice clean class object to put the “Range of Rows” in, but I’ve stumbled into a problem.  I can’t assign the Range object to a Range object in my domain class.  The problem being is the Range object is a bloody piece of @#$% COM object and won’t do a deep copy of the object itself.  So now I need to find some way to do a deep copy of the COM object or I have to open the Workbook’s Worksheet back up again and actually find again each Range of Rows that need to be pulled into the user’s Worksheet.

Overall, this is really ticking me off, the lack of operability and integration with the managed code base Microsoft works with .NET now is the polar opposite of the archaic and frustrating COM derived API of the Office Model.

If any Microsoftie’s are reading this, please, somebody get off the laurels and get this mess fixed.  The Office Model is impossible for all but the crudest of implementations and doing things “right” is almost completely removed from the options list.  Integrating the Office Model, especially with Microsoft’s Tech Stack of WCF, WF, WPF, and all that, is almost difficult to the point that you wouldn’t use Office for anything except if absolutely necessary.  Microsoft needs to fix this, open it up, get some clean API integration and improve the operability.

…and for the love of sanity Mr. Microsoft, practice what you preach and toss that COM @#$%.  It’s beyond frustrating dealing with unreliable COM objects and… well, I could rant for days about COM objects.

If anybody has any ideas on the best way to work around this, shoot some comments at me.  Eventually I’ll figure out something ideal for this, but for now I’m stuck with a really nasty way to get back at the Range of Rows.

Technorati Tags: COM,Microsoft,Office,Excel,Object,Range,Row,Worksheet,Workbook

del.icio.us Tags: COM,Microsoft,Office,Excel,Object,Range,Row,Worksheet,Workbook

Broken Unit Tests, Code Changes, and Refactoring

So the build broke based on a unit test that failed.  Is the general rule of thumb that the build breaking check in person fixes the test?  What if they did something that broke someone else’s test for something?

…hmm, the philosophy of project handling and management.

Today I have nothing to proffer or offer the world of the blogosphere, merely that I’m exhausted and going to gladly jump on my bike and high tail it out of the office.

Tomorrow is implement functionality and dependency injection on the UI day.  At least get started, as it seems our UI has gotten rather dirty the last two weeks of coding.  Time for the refactor.

Modern Computer Power Rulez!

I was running three virtual machines on my laptop and couldn’t help but think, this is awesome.  I couldn’t have imagined doing this 6-7 years ago.

That is three operating systems running in virtual machines.  Windows 2003, Windows XP, and of course Windows Vista.  All running hosted on a Windows Vista Machine – my laptop.  2+ Ghz and 4 GB RAM on dual 7200 RPM 200GB Drives.  Awesome to be able to work with such an environment.

I Love Excel…

…and I hate it.

Excel has a model, that seems to be broken all the time, and appears that there are a zillion ways to do things that are not a preferred way.  The most common situation seems that Excel either breaks, crashes hard, eats up on the memory, or some other monstrous thing happens to cause a day to go south.

But the reason I love Excel, and maybe it is the pack rat collector mentality I have sometimes is – you can put stuff in it.  It isn’t just putting stuff in it, but arranging, formatting, calculating, and crunching the numbers is interesting to me.  For some reason, this almost seems odd, as if I should be bored silly.  But in all seriousness I really dig working with Excel.

That’s my epiphany of the day.  Later I’ll probably write something more useful for myself, but alas, I was thinking…

DI, IoC, and Loose Coupling

Recently a situation were I needed to pull out the dependency injection and inversion of control skills came up again.  The need for loose coupling in so many projects is vital to these patterns.  I was going to start writing an article, but then realized there are some really amazing ones out there.  They point out the reason for Separation of Concerns (SoC), Loose Coupling of UI Components, Controller Independence (free from proprietary UI code).  With that said, here’s some links;

Technorati Tags: Dependency Injection,DI,Inversion of Control,IoC,Loose coupling,SoC,Seperation of Concerns

del.icio.us Tags: Dependency Injection,DI,Inversion of Control,IoC,Loose coupling,SoC,Seperation of Concerns