Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4092564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:30:27+00:00 2026-05-20T19:30:27+00:00

Summary I have written an Excel wrapper in .NET using Visual Basic and Visual

  • 0

Summary

I have written an Excel wrapper in .NET using Visual Basic and Visual Studio 2008.

This question is the continuation of my quest! =P Please have an eye out these questions before you read any further.

  1. How to implement column self-naming from its index?;
  2. How to make this custom worksheet initialization faster?;
  3. What architecture to use to address this SystemOutOfMemoryException while allowing me to instantiate the cells of a sheet?.

I have also consulted other related questions on the topic and found these pretty interesting:

A. Excel Interop – Efficiency and performance;
B. Fastest way to write cells to Excel with Office Interop?.

Hypothesis

I now know that I won’t be able, for performance sake, to walk my way as I expected it on the first draft.

Now, I have written these hypothesis to help me through:

  • Upon creation of a logical workbook, that is, a workbook that is not yet to be saved on the hard drive, I don’t need to initialize my cells right away;

Since I’m don’t need to initialize the cells, I could simply initialize my ReadOnlyDictionary(Of String, ICell) with null cells while building my column names and initialize them into the dictionary.

On the first access of a cell, I could simply check whether it is initialized, and initialize it when it’s not.

  • When a workbook is created on disk, I can have no cells to initialize, that is, I create the file on disk, and return the instance of the IWorkbook interface instance created.

In fact, this workbook just got created and has no values in it yet. Hence, the partial initialization of the dictionary of cells might once again be the way to go.

Aside, let’s say I have to set values to cells, I know that it will get faster if I simply use a two dimensional array which contains the values that I have to set the cells to.

In both first scenarios, the use of an object array outside the ISheet.Cells dictionary is interesting to consider for performance, but seems odd when speaking object-oriented programming, when we know that a cell shall be aware of its own existence. That is what I intended to do while using dependency injection between the Range interop interface and the Cell class.

In such approach, how to arrimate the native cells with a cell value?

  • It is upon the opening of a workbook that I have to initialize the Sheet.Cells with the Ranges that has values.
  • A used cell contains a non-null value;
  • The used cells are returned under two possible ways:
    i. An instance of the Range interop interface;
    ii. Values of the used Range can be obtained within a two dimensional object array.

Architecture and behaviour thoughts

I thought of writing myself a CellCollection or the like to be initialized with the two dimensional array obtained from the (object[,])NativeSheet.UsedRange.get_Value(XlRangeValueDataType.xlRangeValueDefault) and then have a property where I could make the call to a cell with its address (“A1”), which would then get the respective value from the object[,] and return it. When it would come to format a given, I could simply call the appropriate Range given either one or multiple cells.

This thought is yet to be precised and I’m still a bit confused while explaning it. Should you have any question about it, please feel free to ask so that I might myself get things leaner and swifter.

Questions

  • What is the best way to optimize this architecture while keeping it “clean” in regards to its object-oriented design?

  • Are there other alternatives which will allow me to keep the cell addressing feature available while investing into performance?

Thanks to everyone for your kind and valuable help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:30:27+00:00Added an answer on May 20, 2026 at 7:30 pm

    Please see answer to this question for the answer:
    What architecture to use to address this SystemOutOfMemoryException while allowing me to instantiate the cells of a sheet?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple log4net wrapper. I was wondering whether this wrapper code
Summary: I have a struct that is read/written to file. This struct changes frequently,
I have an object Title : foo Summary : foo bar Body : this
A short summary of the question: I have a parent class which is extended
Summary I have written a process monitor command-line application that takes as parameters: The
I'm using NUnit and TeamCity and I have written some system tests with descriptions.
I am using Symfony 1.3.2 on Ubuntu. I have written a little helper function
I have written a little Excel VBA report tool for my iPhone App sales.
Using the ndk I have compiled a code written in C. The program is
I have a function like this defined in one class: using System; using System.Collections.Generic;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.