how to create a custom function for use in a .xlsx in onlyoffice - onlyoffice

I want to edit a .xlsx document in Onlyoffice, and in a cell, write "=TOLETTER(E1)" where TOLETTER is a function that I define.
I know how to do that in Excel (with a VBA Script).
I have done it in Google Sheet (with JS).
I have not found documentation or an example for Onlyoffice. Onlyoffice macros or plugins are closures and I lack the info how to define/export a function that will be visible from the cell.

Currently Onlyoffice doesn't support user defined functions, only macros as you mentioned, using JavaScript and the Document Builder API.

Related

Exporting WebBrowser to PDF with userform or in spreadsheet

I am implementing a feature to my excel-program that will show me a map (from google maps) of some coordinates. The idea is to be able to export this map with other pages to PDF. It looks like I have two options:
1) Inserting a ActiveX "Microsoft Web-Browser" directly in to the worksheet and then having excel export said worksheet to a PDF.
2) Inserting a ActiveX "Microsoft Web-Browser" in a userform.
My problem for 1) is that it doesn't seem to work for newer version of excel (2013>), but it does work for Excel 2007.
The problem with 2) is that it is hard to export a userform to PDF when you also want 2 different pages from the workbook in the same PDF (I do not know if userform1.printform has that feature).
My question is if there is either a way to insert a Web-Browser directly in Excel, for all versions of excel, or a way for a macro to export both worksheets and userform in the same PDF.
I suggest the legal way number 3) Using the Google Maps Static API to download a map as image to a temporary folder and import that image (dynamically) into your Excel file. Then you can export that Excel file to PDF as usual.
The Maps Static API service creates your map based on URL parameters sent through a standard HTTP request and returns the map as an image you can display on your web page.
This means you can download the image file through a standard HTTP request to your computer and place it into Excel.
I'm pretty sure the ways you try to automate it is against Google's terms of use because automated access of Google's services without using the official API is probably not allowed, no matter if private or commerial use (you might get banned).

How can I set up an Access VBA library

I have some VBA code that I use across multiple projects - about 40 or so different data bases all use many of the same functions.
I try to use the same code in application each for consistency. Is there a way I can put all the code in one library and make it available to each data base? I'm getting tired of copying the code to a new data base every time I want to re-use it. I'm especially getting tired of maintaining it in multiple places when I want to change the functions.
I have the same question for Excel - can I create an Excel library and include it in all my workbooks?
If the VBA code works in VB6, you could create a DLL using VB6. The DLL would be a library of methods you could use across board just by referencing the DLL.
If it does not, you should create an Ms Access MDA file (add-in file) for all your reusable code, that can be added into any Access (or probably Excel) project.
Create one or many excel's per project, save those as *.xla. (Excel Add-In)
Go to your Excel Options and configure to load automatically those add-ins or thru VBA in your workbooks.
Using VBA Automation:
Application.AddIns.Add(XLA_Path)

Exporting data to existing Excel file

I have a system with an Excel spreadsheet template file which is used for invoicing. I would like the user to be able to click a button on an Xpage, which will then open the spreadsheet and enter the latest invoicing data in Excel. I don't mind if Excel is either the application on their machine or on the server, but my preference would be the application locally on their machine.
I've looked into Xagents, as I feel this is probably the answer. I know they can be used to create Excel but I have not been able to locate any mention of opening an Excel file, and entering data into specific cells.
Is this possible?
EDIT: you can use Apache POI for editing and creating Microsoft Office documents. This is a java project which gives you a handle to office documents and this can be used using java.
A good starting point can be the blog of Christian Guedemann from webgate:
http://guedebyte.wordpress.com/2012/09/17/documents-and-spreadsheets-with-xpages-building-the-kernel-part-ii/
(end of edit)
The only way I KNOW and tried to write data from Notes to Excel is exporting the data to an HTML page and setting the Content Type accordingly (e. g. as described here (there are a lot more resources available for taht):
http://www.dominoguru.com/pages/developer2010_xpagexlsexport.html
I am not sure if this is of help but it seems that this project can help you:
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=ZK%20Spreadsheet%20for%20XPages
As far as I can see this project can load Excel files from XPages - and then it should also be possible to edit the files.
Besides that the only solution I can think of is a Notes Agent that is called from the XPage. This agent can then run in background and do all the excel stuff. After running, the XPage can show a link to the Excel file. Actually this is the solution I would consider to implement - but maybe others step in with better answers here.
You don't want to introduce a dependency on Excel in your application -- wouldn't work with an iPad front-end. Rather have a look at the ZK Spreadsheet, it will fulfill your needs.
However if you have to have Excel, then you need a roundtrip solution: load the Excel from an URL (probably generated by an XAgent (?) and save it back. The saving back part is the tricky one. Normal HTTP doesn't allow that. What you need there is a webDAV capable server. Watch out for a project on OpenNTF soon (just clearing IBM legal) that provides webDAV.
However the ZK Spreadsheet looks much better for your needs.
I have a sample database at the following URL --> http://www.nnsu.com/nnsusite.nsf/%24%24OpenDominoDocument.xsp?documentId=B65507CB2DE15B3286257986005F061D&action=openDocument
Download the APCC.nsf. This will allow you to create/read a new EXCEL spreadsheet and then stream the resulting file to the requesting browser. There is not need to have EXCEL or office installed on the Server.
THe examples create a new workbook, but you can also store a "template" on the server or in a notes document and use it as a starting point and then save it to a document or stream it to the requesting browser.
With Apache POI you can read/write to a spreadsheet using data from the notes document the process is initiated from.

Surface a .NET method as a UDF in Excel 2007, using a VSTO 2008 Add-in

We have an existing add-in that we publish to users via click once. We would now like to use this as a vehicle to publish some of our existing C# methods directly into Excel so that the users can call them as a UDF.
For example - I have an assembly called MyAssembly, that has a class called MyClass with a public method called MyMethod. I also have an excel addin which adds some item to the ribbon for some custom functionality. I would now like to publish MyAssembly with my existing addin so that a person who has the addin installed can enter =MyMethod into a cell and have my custom method run.
How would one go about doing this?
I solved this quite comprehensively by using ExcelDna, an open source XLL implementation which is very simple to use, and pretty much avoids the whole COM debacle all together. So far it has matched our requirements perfectly...
http://groups.google.com/group/exceldna
you have not been very verbose about what you want to do. What do you mean with "users can call them"?
If you mean that add-in methods should be exposed to VBA you can find two articles on that here:
http://blogs.msdn.com/andreww/archive/2008/08/13/comaddins-race-condition.aspx
http://blogs.msdn.com/andreww/archive/2008/08/11/why-your-comaddin-object-should-derive-from-standardolemarshalobject.aspx

How do I import an Excel Spreadsheet into a blog..?

We are interested in trying to import an Excel spreadsheet into our Blog.
A sample of the Excel spreadsheet that we generate each day and want to export into our Blog is located at:
http://www.wallstreetsignals.com/WhatsWorking.html
Our Blog is located at:
http://whatsworkinginthestockmarket.blogspot.com/
We are interested in a program or method that would allow us to just import the Excel spreadsheet into our Blog instead of having to hand input all the data, which is what we are doing now.
Thank you for your thoughts and the cost to have you help accomplish our goal.
Philip
WallStreetSignals.com
Well, outside of creating a program (which is possible, using PHP, Perl, Java, etc and either an excel input module or converting to CSV or XML and processing that)...
Have you considered using Google Documents or another online spreadsheet software? It's easy to import an excel spreadsheet, and then embed the spreadsheet in the blog post or webpage. Then if you need to change it, modify the google document spreadsheet and the changes are rendered on the webpage or blog post immediately.
-Adam
The easiest thing might be to use Google Docs. Upload your spreadsheet, then publish from Google Docs to your blog. See this article.
Can your blog consume XML? You can set up an XML Schema in Excel 2007 and just export it to an XML file. You would need to write an XSLT.
I also have a macro that will write out XML to a file... can upload that if it would help...
If your spreadsheet is generated by a macro, you could just modify a macro to generate html or some other sort of blog markup ready for copy and paste.
Excel can save as HTML, which you could then strip the metadata from and use in your website. Unfortunately the HTML that it generates is very bloated. If you do not mind client lock-in, you could consider embedding the XLS file directly on your website, and having your viewers use the IE embedded excel viewer.
If you can use ASP.NET you could use SpreadsheetGear for .NET to load an Excel workbook, grab values, formatted values or even images to display on a web page. There are live ASP.NET samples with source if you want to check it out.
Disclaimer: I work for SpreadsheetGear LLC

Resources