How to insert dropdown or checkbox in Excel using Javascript API? - javascript

I'm following the doc (https://dev.office.com/reference/add-ins/excel/excel-add-ins-reference-overview) to build an Excel add-in. The add-in needs to populate an Excel table column with either dropdown or checkbox for the user to select actions to be done on the table row. I can't seem to find any API to insert dropdown/checkbox in Excel spreadsheet. Could someone advise how I could do that? Thanks!

UI controls such as text box, check box, button, etc. are not supported in Office-js. You'd instead need to accept such user inputs within your task pane or dialog box. Alternatively, you could accept inputs within Excel cells as well (though that is bit hard) and drop down values within cells can be included using data validation API (still in beta) to help with controlling input values.

Try getting the cell and calling
cell.dataValidation = {
type: 'list',
allowBlank: true,
formulae: ['"Selected,Rejected,On-hold"'],
};
based on How to add data validation list in excel using javascript

Related

Do I need a javascript to convert an imported CSV field to a list in an Acrobat PDF?

I created a PDF using Acrobat. It includes a List field to which I've mapped a CSV file. The field is populated by an Solutions Business Manager (Micro Focus) form widget. The field appears in comma-delimited form when the PDF is opened. Do I need to apply a javascript in the Acrobat Prepare Form function, in the field Properties dialog box, in order to display the values as a List? And where would I find such a script?
A javascript worked on the SBM side. The relevant command is:
var newListValue = commaDelimValue.replace(/,/g, '\n');
I'm guessing that on account of whatever SBM process writes the content to the PDF, the usual javascript in the PDF Format tab won't work.

Create a web form I can paste excel rows/columns into

How do I create a web form that accepts input that would be copied and pasted from Excel? Basically, I have a table on my website I use for managing my project every now and then it makes sense to just copy and past a section from excel and paste it into the website. However standard form fields just put all the values inside one input.
Is there a way to set up a form with rows and columns that would accept values from Excel and parse it into the same structure in rows and columns to be updated on my website?

How to add JavaScript code to Laravel for BackPack?

I'm using Laravel BackPack to expedite my CRUD webapp.
I have a form with a dropdown list of users.
When a user is selected from this list, I want to populate a text box on the same form with the username of the selected user.
I normally use JavaScript to query the table and return the JSON result.
The returned data is used to populate the #username text box.
I am not sure where to add this JavaScript code in BackPack.
Thanks for your suggestions.
I recommend you create a new field type, starting from the select2 field (or whatever you're using now), and add your JS there.

Transferring excel data into text fields and buttons on a webpage

I want to transfer my text data (From Excel) into a form and submit it. It takes lot of time to perform this operation.
So I'm looking into automation tool which can do this task for me.
Basically this webpage consists of Text fields and button.
Is there any way to fill the text field and click on button, by using the Tag name of text field and button from excel?
Is this for yourself or for deployment to the web?
If it's for yourself, you could save the excel file as a CSV. You should then be able to find a way to process it into something that JS can understand.
Actually setting the value of a text element is simply done by targeting the element and setting its value=someValue. For example, you could do
var t = document.getElementById("firstTextField")
t.value = "someValue"
You could also use jQuery for that sort of thing.
You don't really need to use the browser at all. The browser and Excel are just UI on top of the underlying data and API definition, you can script this out. The general idea:
Inspect the form you're trying to submit. Find the target, the submit method, and the field names.
Export the excel file to a CSV.
Write a simple script to loop through each record and make an http request that corresponds with the form submission - same HTTP method, same target URL, putting the Excel values in under the appropriate input names.
It's hard to be more specific with the information you've provided.

Dynamically populating an ExtJS HTML editor

So I'm using ExtJS for a job I'm working and I'm trying to dynamically populate the textarea associated with the HTML editor with data based on what a user selects from a combo box. From what I've found, I can load the HTML editor with text using the defaultValue property. So if I'm going to populate it after the page loads, can I give it something like a datastore or is there a method I can call to set the text?
Just call foo.setValue("bar");, like with all form inputs.
http://www.extjs.com/deploy/dev/docs/source/Field.html#method-Ext.form.Field-setValue
http://www.extjs.com/deploy/dev/docs/?class=Ext.form.HtmlEditor

Categories

Resources