Save Winforms RichTextBox Data as HTML? - html

I have to convert an Access VBA app over to VB.NET and one of the text boxes (format set to RichText) on the VBA app accepts a straight paste from a Word document including its formatting and saves it to the Access database as HTML... The HTML is then read from the database and displayed as it was originally pasted when retrieved. The issue I have now is, I can use a web browser control to display the data properly from the database, but the RichTextBox gives an Invalid File Format error. When I wish to edit the data I switch the web browser control to the back and copy the data and paste it into the RichTextBox control and then bring the RichTextBox control to the front. This works fine, but once an update is attempted, the data gets saved in RTF format which is not HTML and then when I try to bring it up again from the database, the browser doesn't interpret it as it is not HTML. How can I save it from the RichTextBox, to HTML into the database like the VBA app can?

I've used this in C#:
Create a WebBrowser. Copy and paste the contents from your richtextbox to the webbrowser. And then read the html content (DocumentText) property from the webbrowser.
Edit:
Another way:
Use Office Interop, create a Word file, copy and paste into this file and then save as html.

Related

What clipboard format does InDesign use?

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.

Creating an html formatted file to be opened by Excel

I am trying to export a spreadsheet file from a website. The data is a bit too complex for a simple csv, so I figured the best way to do it was to format it into a file containing nothing but an HTML table. If I give it a .xls extension, it will open, but only after throwing an error and asking for confirmation. Is there a way to set up the file so that Excel knows that it is supposed to have HTML code in it, and so that the OS knows that Excel is supposed to open it?
This is going to be used by people who aren't going think to open Excel and drag the file in or open it from inside Excel. They're going to be double-clicking on the file.

Saving HTML with Checkbox states

I am writing a Perl script that is parsing a file into an HTML table which essentially contains classes and their information. The main objective of the script is for the user to check which classes he needs and the script will read which checkbox states are TRUE and only include those when creating a file that is like the original. Currently, I'm at the point where the HTML file opens in the users default browser, but if I check some of the checkboxes and save the webpage it doesn't save their states (tried it in Chrome and IE). Is there anyway to do this so that when the file is saved the user can hit enter in the program and have it do its conversion?

Code-generation using Excel: Generate HTML from within Excel

Problem:
I have a user who would like to generate an HTML page directly from Excel (without doing file-save as) but instead click a button and have the current worksheet (or a modified variant thereof) contents just 'pop-up' inside a script-generated HTML page. The rationale is that the Excel content could be used to navigate to different web pages automatically, based on the values entered in the cells by the user.
Question:
1) Has anyone done this kind of thing using Excel, and are there any security implications, above and beyond just the ordinary considerations that go with having macros enabled in Excel.
2) Has anyone done this using an alternate methodology?
Why not write a VBA macro that does the "Save As" operation to save the file in HTML format?
You don't even have to record the macro, you could probably record it using the macro recorder.
Start macro recorder
Save As - HTML format
Stop macro recorder
Assign macro to a button

How to paste tabular data into an HTML table

I have an HTML table on a webpage and can edit the contents manually. However, it would make my life much easier if I can copy the data from a file to the clipboard and just paste in onto the form. Can BHOs in IE do this? Any pointers will be helpful.
I have a superset of the data in a file and I don't want to type it all into the webpage.
If your file can be saved as a CSV (using Excel or some other program), then you can use a tool such as the one here (or write your own) to convert it to HTML.