I would like to ask for some help (again), here's my context : I'm trying to create an Excel Worksheet that I can add some coordinates and generate an html page with a map using Google Maps API and his markers.
I have successfully created a macro that get the data from my SQL Server and that also create the html structure (tags,header,body,etc.).
Here's my problem : There is a way to create a macro that get the value of my cell (that contains the HTML structure) and transform it into a HTML page? (Also, I have to be able to save this file into a directory, because it will be used by other users)
Thanks in advance!
Your question basically boils down to this... How do I read the value from a cell and save it to a text file? After all, an HTML file is just a text file with the .html file extension.
So, I assume you already know how to read the value of a cell. Now comes the question of how to write that string to a text file, and that part of the question has been answered before, both in MSDN articles that you can find via a Google search, and right here on SO...
https://stackoverflow.com/a/11503299/1246574
Hope this helps. Sometimes solving a seemingly complex problem is about breaking the question into simplified parts.
Related
My situation is...
I have few hundreds of chrome html files on one folder, and I want to replace certain text(ex. james) to another text(ex. tom) for every html files. Honestly, I'm just a beginner to python, so may I get a detailed code of it? I need 1. how to open every html file in one folder 2. how to find certain text on html 3. how to replace it to another text (on python) Thanks a lot.
you can just open up the directory in VSC and bulk replace all the instances of any string in all the HTML files directly. I required to do the same and found this to be a very convenient method.
I'm still a bit newbie in the code game, and i would like some advices from senpai.
Context :
I'm making a angular 5 app which has a form, which is using also QuillJS, a rich text editor for only one question (the previous questions are simple input field for strings or numbers). My goal is to allow my users to download the form and the text from QuillJS they completed, on a .docx file (Word). And of course i'm doing this because i want to keep the formatted text from QuillJs, otherwise i would have just get a good ol' string.
Issue :
The point is, i'm already building a docx file for the first questions of the form and the only method i found for now to put my html string from QuillJs in a Word readable data type, is to use html-docx-js library.
This post even explain how. But, BUT, i don't want to use saveAs function (see the post), that create a file and put the content in it. I want to put the content in the docx file i'm already creating.
So here is my question, how would you, senpai, do it ?
The thing is that i've got a Blob file (cf post), but i don't know how to put it in my docx file. I tried to see if FileReader function could do the job, but well... i don't get how to integrate this special Blob file type (which is : application/vnd.openxmlformats-officedocument.wordprocessingml.document) in the docx file.
Maybe there is another way, i'm open to any suggestions, i don't mind at all to change my way of doing.
Thank you. Save internet, give me a tip.
The official documentation for html-docx-js does not state any other options than the asBlob method. I suggest two options:
Decoding the DOCX:
The Blob filetype is not special. The blob is just binary representation of the docx. I found in SE question that the docs in fact zipped XML document. You could unzip it using JSZip or other JS solution, then read it using FileReader and try to deal with it in a DOM manner. I'm not qualified to go into details how that could work.
Adding HTML to the user input first and then outputting it as a whole
This is changing the way you want to do it. In this way, I would first create formatted HTML with the data you collected in other parts of the questionnaire. Then you append the rich data from the rich editor. At last you take this HTML data and save it into single file using the asBlob function.
The second solution will maybe strip some customization from your original approach, but it seems much faster to implement.
My question is whether or not anybody knows of a better way to do what I'm already doing. I'm creating a report as a list, and trying to render it both in HTML and Excel.
I'm developing a shiny app that generates reports for Qualtrics surveys.
The results table is a list of HTML strings that I paste together and display in a shinydashboard. Here's a dput of the example results tables.
Here's how I'm creating the html results tables list -- the html_tabelize() function in my package. Here's a dput of the example input.
In the shiny server.R file the way I create the Excel file is with the following code:
output$downloadResults <- downloadHandler(
filename = 'tables.xls',
content = function(file) {
write(html_tabelize(main()[['blocks']]), file)
}
)
To summarize: I get the blocks, I run html_tabelize on them, and then I write the HTML output to a file called "tables.xls". When I open that file, because Excel can render HTML, it renders something like this:
My concern and problem with what I'm doing are two-fold:
If I were writing an Excel document instead of simply rendering HTML in Excel, then I could perhaps get a better formatted document. I'd like that.
When you download the results tables xls file and try to open it, you get a warning from Excel. I don't want the users of my app to see this warning, because it's distracting and could worry them about something that isn't really a concern.
I know that options exist for writing Excel files in R, but so far what I've seen indicates that their input must be either a data frame, or a list of data frames. The list I am rendering from has different types of components, like the question text, as well as data frames of results. Originally I was using pandoc, but pandoc, even when run from R, is a system binary, and it's difficult to list as a dependency (and if I can't list it as a dependency, it's tough to make sure it's installed for the users of my app). Additionally, I found out pandoc doesn't even convert to "real" Excel -- it also just saves HTML in a .xls file. Does anybody have any suggestions as to how I can improve this part of my app?
I'm trying to create data to paste into InDesign and I'm using the following code to copy my data to the clipboard:
Clipboard.generalClipboard.setData("dms", xml.toXMLString());
But when I paste it into InDesign, it shows the code rather than the formatted content. I don't know if the ClipboardFormat is correct and I don't know if my data is correct (it is the whole IDMS XML document). Does anyone have a working example or tell me what's wrong?
Here is what I get when I check the formats property of the Clipboard.generalClipboard.formats array. It also contains the format value:
air:file list:null
air:url:null
It is copying a file or file reference to the clipboard.
I'm trying to create a store locator based off the static csv example used by Google http://storelocator.googlecode.com/git/examples/panel.html
I have recreated this example on my own server but if I edit the csv file in any way, even if I just remove some of the rows it returns a blank map.
I was hoping I could use this example as a template by replacing the default values in the csv file with my own(http://storelocator.googlecode.com/git/examples/medicare.csv). There is clearly more to it than I assumed and was hoping someone could point me in the right direction in terms of why I can't just edit the fields in the csv with my own values and what else should I be editing?
This is their main page http://storelocator.googlecode.com/git/index.html
I have been searching online for a way to do this and I have now asked this question here as I am struggling to find an answer.
It seems when I opened in excel it was reformatting the csv file and causing it not to work. When I edit the fields from the csv in notepad++ it works. Apologies for the useless question. Thanks Dr Molle for bringing this to my attention.