Create Spreadsheet in .NET Compact Framework 3.5 - compact-framework

I hope this is not a repetitive question; I've searched on the site but I was not able to find anything.
As the title say I would like to create/edit spreadsheet on a .NET Compact Framework project.
On desktop project with the full size framework I use, with pleasure, ClosedXML but if I try to use this I get multiple errors so I'm searching for an alternative.
I have found a commercial option (TMS Flexcel Studio for .NET) but I was wondering if there is something free to use.
I know that I could simply create a csv but I want to do something a bit more modern.
Thanks in advance to everyone who will help.

Ok, after trying a lot of free librery i found a solution.
Excellibrary works! link to google code
I have tried it with Visual Studio 2008 in combination with a Windows CE 5 device and it created an xls file easily.
I must test it to check the performance but at least it works and it's free.
Also the sintax is very simple
Dim file As String = "\HardDisk\newdoc.xls"
Dim workbook As New Workbook()
Dim worksheet As New SpreadSheet.Worksheet("First Sheet")
worksheet.Cells(3, 3) = New Cell(3.45)
workbook.Worksheets.Add(worksheet)
workbook.Save(file)

Related

Get the version of MS ACCESS

ALL,
Is there a query which will give me the version of the mdb/accdb file created?
Or this info is not stored anywhere?
Background:
I'm working on C++ program, connecting with ODBC driver and want to know ACCESS version behind this file.
TIA!!
Short answer: No
It has been requested from many to have an option to check if a database file supports, say, BigInt or DateTime2 but, currently, you are left with trial-n-error.
However, if you don't plan to modify the scheme, your only concern should be, if the database file is of the old mdb (JET) form or the newer (introduced 14 years ago) accdb (ACE) format.
You can easily obtain that information using DAO, the Database.Version property.
In vbscript, that'd look like this:
Dim dbe
Set dbe = CreateObject("DAO.DbEngine")
Dim db
Set db = dbe.OpenDatabase("C:\Path\To\Db.accdb")
WScript.Echo db.Version 'E.g. 14.0 for Office 2010
Using COM is a lot more verbose in C++ so I'll leave that to you, but the approach could be the same.
Using only ODBC, I'm not sure how to obtain this information, though.

Crystal Reports & VBScript - Could Not Locate Automation Class

First off, I have very little Crystal Reports experience, so apologies in advance if this is a stupid question. I had this "fantastic" work project dumped on me when a co-worker left, so I'm hoping someone can help as most of the Business Objects links I find that might have solutions just redirect to a generic SAP splash page.
So I have a few hundred Crystal Reports (mostly File Schema 10.2, although some are 8.5 or 12.0) that are stored on a server. All of them have an associated VBScript file that calls them in the following way:
Set AppCrystal = WScript.CreateObject("CrystalRuntime.Application.10")
Set CrystalReport = AppCrystal.OpenReport("<file path to report>")
Set CrystalOptions = CrystalReport.exportOptions
CrystalOptions.DestinationType = 1
CrystalOptions.FormatType = 36
CrystalOptions.DiskFileName = "<file path to output excel file>"
CrystalReport.Export False
According to BO, this should be correct. See the following links about the CR API:
http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RDC_SDK/rdc_com_dg_doc/doc/rdcsdk_com_doc/RDC_ObjectModel62.html
http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RDC_SDK/rdc_com_dg_doc/doc/rdcsdk_com_doc/RDC_ObjectModel151.html#1387900
http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RDC_SDK/rdc_com_dg_doc/doc/rdcsdk_com_doc/RDC_ObjectModel8.html#1646326
So basically the script just executes the report and outputs it to an Excel file. This works great on the old server, but when I try to execute this script on the new server I get the following error:
I assume this is because there's some kind of runtime components I need to install, but I can't for the life of me figure out what. I found this page: https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567
But none of the files I've tried to download have worked, and, frankly, I've found SAPs documentation to be sub-par in this area. I do have Crystal Reports 2008 available, so if I need to update the vbscript to use CrystalRuntime.Application.12 or something and then install the newest runtime files for Crystal Reports 2008 on the server, that'd be fine. But I still need to know what runtime files to use? Nothing I can find has worked. Help?
Apparently this type of call to a Crystal report uses the RDC Report Engine, unfortunately CR 10 is no longer available. You can still get CR XI R2 which still deployed the RDC and it's version 11.5.
There is no RDC in CR 2008, it was actually deprecated in CR 9 and now no longer shipped.
Only other option you have is to convert your app to use Visual Studio .NET and use one of the current CR 2008 or CR for VS 2010 components and rewrite your app to .NET Framework.
No more VB Scripting supported, but that was just the Dev Language...
I ended up just upgrading to CR 2008, and using .NET console projects to replace the VB scripts.

reading excel server-side

I need to develop a service and install it into a w2003 box to read excel files a then process its info. The process is as follows, users will upload excel files using FTP and then my service must take those files, validate and then update a SQL Server DB.
The application runs fine on my computer but on the server it asks for the libraries but when I try to install the MS office 2003 Primary Interop Assemblies, system displays "Please install Microsoft Office 2003 before installing the product".
I'd prefer to stay away of any server upgrade as we should require OKs, etc.. so, is there a simple way to just read excel files without having to install any update in the server.
any comments are welcome.
Thanks,
m0dest0.
ps. using vb.net and vs 2008.
Using Interop on the server is NOT supported by MS - see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
Since Windows Vista MS introduced several security-related measures which prevent a Windows Service from doing "desktop-like" things... which means you would have to circumvent several security measures to get it to work (NOT recommended!).
To deal with Excel in a server-scenario there are several options (free and commercial) out there:
I can recommend Aspose.Cells and Flexcel... didn't try SpreadsheetGear but hear+read lots of good things about it...
Free options (though for the newer xlsx format only!) are for example OpenXML 2 from MS and EPPlus.
For a solution with nothing to install on any recent versions of Windows Server..... I'm not sure the exact VB.NET code, but you should easily be able to do this on any machine using the Microsoft OLEDB drivers that should be available on any recent version of windows server or can be installed from a free download off of the Microsoft website for very old versions of windows server. I'll try to pseudo code this, so you will have to adapt it for VB.NET. Note that in order to reference your fields by name, the first row of the selected area in the worksheet must contain the fieldnames in the column values. Otherwise you will simply have to use numeric values to index each returned field by column position.
Set objExcelConnection = CreateObject("ADODB.Connection")
objExcelConnection.Provider = "Microsoft.Jet.OLEDB.4.0"
objExcelConnection.ConnectionString = "Data Source=d:\path\to\excel\file\on\your\server.xls;Extended Properties=""Excel 8.0;IMEX=1;"";"
objExcelConnection.CursorLocation = 3
objExcelConnection.Open
sSQL = "select * from [worksheetname$]"
set rsWorksheet = objExcelConnection.Execute(sSQL)
do while not rsWorksheet.Eof
sValue = rsWorksheet("FieldName")
rsWorksheet.MoveNext
loop
rsWorksheet.Close
set objExcelConnection = nothing
I use the Excel Data Reader (http://exceldatareader.codeplex.com/) when I need to process Excel files. It handles xls and xlsx files without a hitch, and I've got it running in a few applications on a server OS. It saves each sheet as a DataTable object, and each "cell" in the DataTable corresponds to the Excel cell with the same address. Depending on how you set up your SQL server link, there might not be too much conversion required to dump the contents into the DB.

Saving multiple visio diagrams to HTML

I am maintaining a set of process diagrams in visio 2007. For viewing I save the files as HTML and publish them on a web server.
It works great but its a real pain to maintain (a paintain ;-).
I am looking for a way to do this as some kind of batch job, currently the process is:
open each file
file>save as web page
in the save as web page dialogue:
select location
publish > open new dialogue
change title (i dont mind if i have to miss that step)
select web page to insert it into (my template)
done
The tools I have availiable are:
Visual studio 2010 express (i prefer c# but whatever)
Visio 2007(i have another laptop with visio 2010 which i can use too but the source files will be 2007 - that's not changing for the moment)
Ruby - may be easier if it doesn't require office integration.
(BTW I know about process repository in OSS 2010 and i have tested it with visio 2010 web diagrams - that works and would probably be a better option for anyone who has the choice, though its not perfect)
(batch file or command line would also be cool but i have not found a way of saving as web page from command line)
You can use Visio's COM interop API to do what you want (I think). I'd start by just recording a macro while manually doing the export, and then look at the VBA code that generates. You could then adapt that in C#, or VBScript/VB6 if you want something you can call with a command shell.
As Jon highlights, there's a whole API for using the SaveAsWeb functionality from code. I wrote a post about it a little while ago, which you can see here:
http://visualsignals.typepad.co.uk/vislog/2010/03/automating-visios-save-as-web-output.html
The post is VBA based but the .net version is very similar and there's also examples in the Visio 2010 SDK:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=12365

How to connect to TFS using VB

I'm writing an application that needs to connect to the Team Foundation Server, and then get the last version of a specific file from a specific project. At the begging I did this by using an external .bat, but I'd preffer running eveything inside the code.
I've been looking for examples but all I can find is written in C#. All I got so far is:
Dim tfs As TeamFoundationServer = New TeamFoundationServer(nameOfServer)
Thanks!
Finally I manage to solve it:
Dim tfs As TeamFoundationServer = New TeamFoundationServer(serverAddress)
Dim vcs As VersionControlServer = tfs.GetService(Of VersionControlServer)()
vcs.DownloadFile(fileToGet, fileDestination)