Posts
413
Comments
230
Trackbacks
42
December 2009 Entries
Happy Holidays From A Microsoft Lawsuit

It seems that Microsoft has lost a lawsuit over their custom xml implementation for Office Open XML.  This was about the worst news I could get just before the holidays since I have been working on creating solutions around just that feature.  To me it is the most flexible part of the OOXML standard and crosses all types of Office documents.  I can only hope that they settle this dispute so we can get back to moving forward document generation processes.

Posted On Wednesday, December 23, 2009 9:36 AM | Comments (0)
New OOXML Blog

I am starting to write a new blog with my co-worker Andy Schwantes on open document standards and development.  I will be cross-posting much of the content here.  Check it out.

Posted On Wednesday, December 23, 2009 7:38 AM | Comments (0)
Future CAG Topics

CAG

In an effort to better serve the Chicago architecture community here is a preview of upcoming topics.

January – Dependency Injection and Inversion of Control Containers

February – Amazon Cloud Service

March – Data Integration Architecture

Future:

Document Generation Architecture

 

 

 

Posted On Friday, December 18, 2009 3:46 AM | Comments (0)
Dealing With Shared Strings In OOXML

Shared strings are the way that Excel reduced redundant data in a worksheet.  They are also important if you are working with charts in Word documents or PowerPoint slide decks.  Instead of inserting string constants into a cell you give it the index of the string from the SharedStringTable and mark the cell as having a shared string reference.

So what does it take to work with the SharedStringTable

The first thing you need to do is retrieve the existing shared string table.  This is a fairly simple operation as is demonstrated below.

SharedStringTablePart sharedStrings = tempSpreadsheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First();

Another operation that you will want to do is finding strings within the table since the entire purpose of using it is to eliminate redundancy.  I handled this by creating a simple method after converting the SharedStringItems of the table into a List<T>.

private static int GetIndexOfSharedString(List<spreadsheet.SharedStringItem> items, string text)
{
int result = -1;

for (int index = 0; index < items.Count(); index++)
{
if (items[index].Descendants<spreadsheet.Text>().First().Text.Trim() == text.Trim())
{
return index;
}
}

return result;
}

Lastly you will want to add new strings to the table.  This is fairly straight forward, but note the last three lines.  If you don’t update the counts you will find your new items never save.

sharedItem = new spreadsheet.SharedStringItem();
sharedStrings.SharedStringTable.AppendChild<spreadsheet.SharedStringItem>(sharedItem);
sharedStrings.SharedStringTable.Count++;
sharedStrings.SharedStringTable.UniqueCount++;
sharedStrings.SharedStringTable.Save();

That is really all there is to it.

(Note: for those who have complained about the code formatting I hope this is better)

Posted On Thursday, December 17, 2009 4:41 PM | Comments (0)
January 2010 – Chicago Architects Group Meeting

CAG

The Chicago Architects Group will be holding its next meeting on January 19th.  Please come and join us and get involved in our architect community.

Register

Presenter: Tim Murphy 
Topic: Dependency Injection and Inversion of Control Containers 
 
Location: Illinois Technology Association
200 S. Wacker Dr., Suite 1500
Room A
Chicago, IL 60606
Time: 5:30 - Doors open at 5:00

Posted On Thursday, December 17, 2009 3:55 PM | Comments (0)
nPlus1.org ArcSummit Wrap-up

On December 7th I presented at the nPlus1.org ArcSummit.  My talk was on Dependency Injection and Inversion of Control containers.  Thank you to all those who attended.

 

When we were done Chris Woodruff and I were asked to record an episode of The Thirsty Developer.  It was a great experience seeing how these shows are put together and being able to just sit down and talk with Dave Bost, Clark Sell and Chris Woodruff.  I’ll post again when the episode comes out.

 

The slides for the presentation are available here.

The code is available here.

Posted On Tuesday, December 8, 2009 7:48 AM | Comments (1)

Tim Murphy

Tim is a Solutions Architect for PSC Group, LLC. He has been an IT consultant since 1999 specializing in Microsoft technologies. Along with running the Chicago Information Technology Architects Group and speaking on Microsoft and architecture topics he was also contributing author on "The Definitive Guide to the Microsoft Enterprise Library".



I review for the O'Reilly Blogger Review Program



Technorati Profile

www.flickr.com
Tag Cloud