Javascript Searching an Excel file - javascript

I was wondering if it would be possible to use Javascript to search through a column of an excel spreadsheet for a value that matches what a user types into a textbox. If a match is found I'd like to retrieve the row number the match was found on and put that number into a variable. I'm making a small database and would like this site to independent of using a database program like SQL if possible.
Is it possible to accomplish this with javascript? If javascript is incapable of this is there any other scripting language that can handle this task?
Thanks

You can use JavaScript with older versions of Excel. Here's an example: http://support.microsoft.com/kb/234774
You can use Windows Script Host to run in a shell other than a browser:
http://msdn.microsoft.com/en-us/library/9bbdkx3k(v=vs.84).aspx
Here's the Excel 2003 API reference:
http://msdn.microsoft.com/en-us/library/aa272268%28v=office.11%29.aspx

Scripting Microsoft Excel in JavaScript is a new thing, only Office 2013 supports it. Here is the doc. Here is a useful intro.
For older Office versions, use VBA macros, or write an application in C# which uses Microsoft.Interop, as #PortlandRunner suggested.
UPDATE I forgot to mention that C# is not the only technique to work with Excel files from external code. #KevinCollins is right, there is JScript and VBScript too. For the sake of completeness, I would like to add PowerShell to the list, you can also work with Excel files using PowerShell.

Related

Writing a new function for excel

I am looking for ways to write my own function in excel that I can use directly in cells, but I do not want to use VBA or COM. My preferred language would be javascript or C#.
I am using office 365, so I have the latest version of Excel. Also, it would be nice to make it work on Windows and Mac.
Have you checked out this answer found here on stackoverflow? It includes a link to Excel-DNA and some sample code to create your own functions.
Creating new Excel formulas/functions with C#

Task Pane Add-in: Equivalent of Document.getFileAsync method for Excel 2013 Desktop?

I am developing a Task Pane add-in for Microsoft Word, Excel, and PowerPoint desktop. I would like to have the ability to read the entire contents of the file and save it as a new document to a third-party application. Microsoft Word and PowerPoint support the Document.getFileAsync method to get the entire contents of a file; however, Excel desktop does not seem to support this functionality. Excel Online does, and I can actually use that method to save a new Excel file to my third-party app. Is there any way that I can get the contents of an Excel file using a desktop Add-in in order to create a new file?
I am using Microsoft Office Home and Business 2013 to test.
At this time, you already mentioned it yourself, the getFileAsync option is not yet available for Excel -on the Desktop- (see table on the bottom of https://msdn.microsoft.com/en-us/library/office/jj715284.aspx ).
So your option, for now, might be using the Ooxml coerciontype using OpenXML:
Some examples: https://msdn.microsoft.com/en-us/magazine/jj991976.aspx
I'm sure it is a matter of time, but that's not the answer you wanted to hear today.

PDFium limited javascript support

I would like to use the built-in JavaScript for PDFium. I know PDFium has limited JavaScript support but I have seen posts that it does have a few available commands.
Here is what I'd like to do, when the pdf is opened (in PDFium), I'd like to have it automatically open to the last page and remove the print button. These are both available commands using the PDFium source, but I haven't seen any documentation/examples on how to use them.
I am assuming I can embed these commands into the PDF itself but I'm at a loss as to how.
Available parameters I found are only few: Adobe parameters
A possible workaround for the last page is to set the parameter #page=100000 to 100000 for example.

PDF forms get online content

Would it be possible to use the inbuilt Javascript in adobe pdf forms to get contents/scrape a web page?
When I googled if Javascript could do this there where CSP errors,
but pdf forms does not have this as far as I know.
thanks,
g3
As you suspected, it is not possible to achieve this with Acrobat's Javascript extensions.
There are a number of third party tools that can convert a website to a pdf. If you also need to build a form, rather than just convert a webpage, you could write a program that would leverage a third party conversion tool, then build the form using Acrobat's Interapplication Communication API reference. If you're more comfortable with Javascript, you could even use the PDDoc's JSObject to build the form with Javascript.
You could use the wkhtmltopdf tool to get the HTML Content of a website and save it to a PDF
Then you can simply run
wkhtmltopdf http://google.com google.pdf to get the Content of Google.com and save it to the PDF "google.pdf".
It is possible. Check out the methods of Net.HTTP found in the "JavaScript for Acrobat API Reference". You might find a more recent version of the reference here.

How can I run Google's prettify to generate static HTML (w/ CSS) output?

I'm working on prettify'ing some auto-generated emails that often have code snippets in them. I want to use Google's prettify project to syntax highlight the code snippets.
How can I invoke prettify on the server, before sending out the email, such that users will still see the highlighted syntax when javascript is disabled in their mail viewers (Outlook). I'm thinking I need some sort of browser emulator since prettify is manipulating the browser DOM.
Running the plain JavaScript on the server is possible using Rhino or the Google v8 interpreter, but that would mean you'd have to scan the emails, find all the code blocks, write a special call to prettify so it returns the formatted code instead of replacing it on the DOM... not too practical, plus you'd have to have shell access to your server to get v8 going.
If you are interested in that, look here:
Running V8 Javascript Engine Standalone
Now, the other way would be to use one of the many server-side highlighters like Hyperlight (http://code.google.com/p/hyperlight/) or Pygments (http://pygments.org/)
Lastly, you'd have to include in the emails all the CSS from the themes used by any of the above methods, which isn't too big of a hassle, but increases the size of the email, even if all what was there to highlight was a variable name, for instance.

Categories

Resources