I know the title seems a bit simple, and sounds more like a forum post at the wrong place, but sometimes the easiest assumptions may not be the best for us, same as the easiest implementation can be tricky for your code. It may happen that for unseen reasons, the environment where your application runs, changes and not every time can this be under your control. You cannot control where anyone is going to run the application you built, you can only suggest. As a developer everyone has faced situation like this, and we at ComponentOne too faced them. That is why when we designed our libraries/controls we kept in mind many implementations that you may need to use, so that you may not face these situations. One such example is the ease of use to load information in our C1XLBook class of ComponentOne Excel. Not only can you directly read from a file lying on your disk, you can convert your data in to streams, play around with them and then send them off to ComponentOne Excel control to work on it as an Excel sheet. C1Excel provides one simple method to load all your data in excel file format, be it the classic .xls or the later Office Open XML format, the .xlsx. s the C1XlBook.Load() method present with C1Xlbook. We have provided a number of overloads in it, which can serve many very useful purposes, imagine some of them below, 1. You have all your data coming through memory streams, maybe you read it off a Database, or you got from a response, but now you want to share it across as an excel file, another possibility could be, you have concatenated a number of files, and stored them directly in memory, rather than using file streams. How do you end up doing it with least fuss?
System.IO.MemoryStream ms1 = new System.IO.MemoryStream(); //Hypothetical blank memory string, this section can be used as required for your //own manipulation of the Memory Stream c1XLBook1.Load(ms1, C1.C1Excel.FileFormat.OpenXml);
2. You have number of excel files on your drive and your application deals with loading and modifying each of them at some point of time. When you do have an excel file readily available, C1Excel makes it even more easy for you to get hold of and play with them.
String path = String.Format(@"..\\..\\test.xlsx"); //Hypothetical easy situation c1XLBook1.Load(path);
Notice the major difference between the above two overloads? No FileFormat in the latter line of code, and why is that so? Because, ComponentOne Excel is inherently intelligent enough to know what is the format of the Excel file to be loaded. Now, using this piece of information, imagine how easy it can be to manipulate your files. To make best use of this post, refer to this post on FileFormat flags for C1Excel as well. For other such cool features, download Studio For WinForms, here. Please visit our forums, here.