Excel js addin and COM object - excel

MS introduced JavaScript API for Excel. Based on the doc it seems like it supports desktop version of Excel too.
For c# VSTO addin the way to communicate with Excel is through Marshaling (COM object). Chaos happens if too many COM objects are acquired without proper clean up.
So the question is, does the js addin has those pitfalls? More specifically does js API use COM at all? If it does, is there any difference between Windows and Mac version? I thin Mac does not have the concept of COM (correct me if im wrong)

The Office.js APIs don't share any of the COM legacy with the current VBA/VSTO/COM add-in model. It's brand new code, written specifically for cross-platform needs. Where possible (e.g., Excel), the vast majority of this new code is actually shared between Desktop and Online and iOS and Mac. For other host applications, the code itself might not be shared, but we do everything we can to ensure consistency -- and for the new host-specific APIs (Word, Excel, and OneNote namespaces), have been favoring implementing APIs where support can be uniform across all the hosts. That is, if an API says that it's part of ExcelApi 1.3, you can be guaranteed that any of the Excel platforms (Desktop, iOS, etc.) that support 1.3 (Office.context.requirements.isSetSupported('ExcelApi', 1.3) === true) will have all of the APIs that are part of that set.

Related

COMException when trying to create Excel.Workbook

short disclaimer in order for you to understand how to phrase your answers: I am a total newbie when it comes to programming. All I know are the basic concepts of object oriented programming and VBA, but that's about it. Sometimes VBA is a little annoying though, e.g., when trying to run something in the background. This is what I am trying here.
I am using C# in Visual Studio. When trying to create a new Excel Workbook this exception is thrown:
System.Runtime.InteropServices.COMException: "Retrieving the COM class
factory for component with CLSID
{00020819-0000-0000-C000-000000000046} failed due to the following
error: 80040154
I've done some research and found this thread. The problem is that I don't really understand what I need to do. Maybe someone can help me through rather basic instructions :-D.
Thanks in advance!
All the best,
Till
This is a good indicator that something is wrong with your windows registry keys for Office. In that case I'd recommend repairing Excel or Office, so the required windows registry keys can be restored.
Also be aware, Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.

How to find the alternative class/method for harmonyOS in androidOs?

I am a fresher who works on HarmonyOS where we have to map android imports to respected to HarmonyOs using an excel sheet, which consists of alternative imports but some are missing in that Excel. where can I find all the alternative methods?
There is no direct substitution or mapping between the methods of HarmonyOS and Android. You need to query the official APIs based on the site requirements to find a method that meets the requirements.
API reference documents provide you guidance in using the APIs of different programming languages, as well as standards and specifications required for app development with these APIs.
Java API References
JS API References
You can refer this example for Java Harmony OS APIs for Android developers.
https://medium.com/huawei-developers/java-harmonyos-api-for-android-developers-cheatsheet-9de077561732
For some classes direct one to one mapping might not be available for now.
In HarmonyOS developer doc there is Reference Document Outline for Java APIs, Native APIs. Please check https://developer.harmonyos.com/en/docs/documentation/doc-references/reference-document-outline-0000001115016824

Is there any way to know if a program was created with VB, C# or Delphi?

Is there any way to know if a program was created with VB, C# or Delphi and the compiler version?
The easiest way would be to use some software like DependencyWalker and just see what DLLs they use.
.NET binaries are easy to figure out, And there are also software that deassemble them back to C#.NET , VB.NET or C++.NET code for you (whatever you desire)
You can't determine if a .NET binary is written in VB.NET or C#.NET since it is converted into MSIL (Microsoft Intermediate Language).
Also applications like resource explorer should tell you information about the binary.
If you're a little more specific, I can provide more.
Yes.
With Delphi applications, you can use a resource editor like XN Resource Editor. Each executable has an RC_DATA resource called DVCLAL that identifies it as a Delphi app (and contains info about the compiler version). If the app uses the VCL (is a Windows GUI application), you can also see other RC_DATA resources that represent the form file (DFM). You can also view VCL/RTL classes in the binary using a hex editor.
Reflector can show you if an app is C# or VB.NET.
DependencyWalker (linked by another answer) will show you if the app is loading the VB runtime, which would identify a VB Win32 application.
you can use a tool like PEiD (unfortunately this project has been discontinued, but the application is still working).
PEiD detects most common packers,
cryptors and compilers for PE files.
It can currently detect more than 600
different signatures in PE files.

Which development platform should I use for desktop Windows application?

After doing web development for quite a while, I am faced with a new client who wants a simple database application to run outside the interweb.
He is quite adamant about using Microsoft products. "We don't want no steenking open sources" was his stance.
It's been quite a while since I actually did desktop development, and most of my tools are rusty, out of licence, or just plain lost. I have been concentrating lately on L.A.M.P. applications, but that doesn't quite transfer back to the desktop environment.
Some options:
database: MySql (my fav), Access, MSSql
language: C++, VB, PHP, Java, C#
I have been gravitating towards Access/VisualBasic, not because I like it very much, but because it is simple to set up and deploy. A database server (MySql, MsSql) would probably be too hard to deploy/maintain for the novice computer user. Even though from a purist point of view, C++ is the better language, it would take too much effort to bootstrap an application (IMHO). Java is too cumbersome (again IMHO).
The other consideration is cost. Although I can convince him to acquire proper software runtime licences, I probably won't be able to get him to purchase necessary development tools, and certainly the project isn't paying enough to justify substantial purchases which will probably not be used again.
I would appreciate your input on platform selection, development tools and application frameworks, thanx muchly.
Edit 23-May-09
Thank you everyone for your excellent advice.
I have settled on C# Express. So far, I've avoided learning C#, but what's another language?; and I have a whole week to get up to speed.
I am waffling on whether to go with Access or MSSql (Express) database. With Access, I can deploy the database as a stand-alone file, but MSSql requires that the database server be installed. (AFAIK)
The client requires that the application be installed in multiple locations, some of which are mobile and not connected to the interweb. The dicey part is reconciling all the copies of the database, and determining which is the connonical version.
I'd go with the Express editions of C# and MSSQL. Free and easy to use/set up/deploy. Here's a deeper link to some general material specifically about using VS Express editions for Windows applications.
I suggest: Just use Access. It works for small, simple, single user databases. It's not "just a database" it's also a "database application" and "database application development environment" in it's own right. That is: It's ridiculously quick and easy to throw together a db, CRUD forms, and simple reports; and the built-in VBA is handles most business logic, and you can allways call-out to C# dll's if you need to do anything "interesting".
Just tell the customer they need to loan you the production box for the duration of development (fair enough), and that Access (no need to mention which version) is about $200.00.
Customers who don't pay get they get what they ask for, not what they need.
C# + MSAccess/MSSql(express) = Profit.
I don't know exactly your requirements, but I would suggest the following:
If you had the budget:
Visual Studio Professional
MS SQL or Access
DevExpress Components for forms and
database persistence.
If you don't have the budget
Visual Studio Express
MySql
NHibernate or Linq2Entities
WPF or Windows Forms
I don't know why you think another database engine would be easier to administer than MS SQL. There's a free-as-in-beer edition of MS SQL called 'Express' that might suit. It supports all the same DDL and SQL features as the full database engine: in case you need them; it's just limited in size and number of CPUs.
Likewise there are free/express edition of the developer tools, which aren't missing much functionality (most notably perhaps the ability to write an installation program, but there are other free ways to do that). I don't know PHP or Java but if I were given a choice between C++ and C# (I'm familiar with both), I'd say that C# is virtually as capable for most applications except perhaps soft-real-time, and is quite a bit easier and more pleasant.
My preference would be C# with MSSQL Express. You can use the visual studio express edition for your development environment.
Have you considered Delphi or C++Builder there are free versions available.
Microsoft Visual Studio has express editions which are either cheap or free. That said, the choice is obvious: Winforms with C# or Visual Basic .Net (it's just a syntax question) talking to a MySql backend (for cost issues).
Microsoft Winforms is awesome but limited to Windows (Mono notwithstanding). Enjoy the project. It's way more fun than LAMP in my opinion, but not nearly as universal.
Edit: If you have the extra time and patience (of course you would have to eat the hours and not bill the learning time), though C# is brilliant and very mature (even in .Net 1.1 it was :), you may want to write the app in one of the Python variants for .Net. That's what I would do... Python has a huge following and will probably come up sometime in your non-Microsoft future. C# on the other hand... well, if you Mono it could come up, but otherwise, it's like learning Italian: good in Italy, but useless otherwise. (I should know, I'm writing this from my place in Venice...)
C# or VB.Net with SQLite.Net for the database. Pretty much cross platform across the board.
If you need a database local, one file (.dat) or the suggested from one's IDE (berkeleydb) or Sphinxsearch() Relevance sort order with pivot tables are often what users want and no database required only i/o according to document or graphics type.
If you are developing application on desktop. I would say
Scripting Language:ASP.NET(C#)
Database: MS SQL 2005
Server: Windows Server 2003 with IIS 6

What are the pros and cons of developing a SharePoint component versus a standalone app?

A client wants us to develop a Picture Library system for them. The requirements are pretty typical - need to add pictures, tag them with metadata, store different sized versions and so on.
The client is keen on it being developed as a component which plugs into their existing SharePoint system. However, my feeling is that we would be better served building a standalone app - that way we don't have to shoehorn it into a SharePoint page and muck about integrating with SharePoint's APIs.
I am trying to look at this objectively and would welcome any arguments either way that people have.
Using an existing framework like Sharepoint imposes a lot of constraints on the design which makes the software architecture more uniform.
It does require some work on the part of the developer, because the developer does have to understand the API architecture and API's, etc.
However, developing a standalone application is the way that business's software architecture becomes a mix of 200 applications, using 20 different languages/architectures/platforms, half of which were developed by people no longer there - in short, a mess.
Sharepoint is documented, and will be supported probably long after you leave the company. Can you guarantee support for the application that you develop for as long as Microsoft will support Sharepoint?
You should do a cost/benefit analysis of integrating with SharePoint. You have listed some cons for integrating with SharePoint. Here are some pros.
Widely adopted platform.
Existing functionality to store/retreive/update images to data store.
Existing functionality to tag images.
Existing functionality to group several images together and treat as one virtual document (if using SharePoint 2010).
Keep in mind that you can integrate any custom ASP.NET page/application in Sharepoint so you can approach development like a standalone app. Your client wishes might include synchronization with Sharepoint's own picture library functionality and in that case you'll have to work with it's API.
It seems with SharePoint you are already done because it can more or less do what you describe already. What requirements do you have that cannot be met by OOB SharePoint?
I've used picture libraries for something similar before. While they have their quirks you do get a lot 'for free' like a UI, bulk uploading, metadata and 2 alternate sizes rendered.. My biggest gripe is they don't support the datagrid view so I cannot edit list metadata en masse like you can with other list types.

Resources