Retrieve Form Data From HTML Form with VBA - html

I'm trying to write a Macro that retrieves data on all HTTP Post forms from a webpage, and then displays the possible inputs as column headings in a worksheet. (Later I'll write another macro that constructs the appropriate requests based on input from the rows below.)
I've spent a day trying to parse the HTML with regex, (classic rookie mistake, right?), and it's a disaster. Nothing seems to work for more than a couple of webpages.
My question is sort of a big picture one. Should it be able to work with REGEX? Should I be taking an entirely different approach? Is this too big a task for someone who doesn't know a whole lot about html, and web development more broadly? I thought it would be a simple project, but it just doesn't seem to be.

don't use regex. use an html parser. Since you said you're using vba, I'll make a guess that you have excel installed. excel has a "import data from web" function that works on any well formed html table.
and if that doesn't work, most platforms that have vba also have a web browser control of some kind. load your target web page in an instance of said control, and access the table you want with the DOM's methods.

Related

Using a Word template in SSRS

I have a word document currently used in a mail merge. My product owner wants it setup to use SSRS so we can take advantage of internally generated data in addition to the stock data our vendor's platform provides. The platform integrates with SSRS so options that are not SSRS are not available to me. I found this question but it's been inactive for 9 years and didn't get a lot of traffic and the linked blog post appears to be gone.
Using a Word document as a template for an SSRS report?
Is there any way to use the word doc as a template, or some kind of starting point in SSRS?
Unfortunately this is not possible without a lot of work. I had the same issue several years ago and ended up writing an application in C# to do all the work. This was not something that we could achieve in a few days.
Just in case you considered going that route, here are some of the issues you might face and what we did to get round them.
Font/Styles: We wanted to apply certain styles to sections such as the contents page, numeric tables, blocks of text. Within the SSRS report was an option to 'use tags' (via a report parameter). This allowed us to add tags that could be used to search/replace or style anything within them. The app would look for these tags style according to the template
Nested tables: Our reports were mainly tables of data interspersed with blocks of text. SSRS tries to gets things to physically align with what you see on screen so it tends to put everything in tables. This causes problems when you want to find blocks of text etc (as above) so I had to write a routine that would look for the innermost table and extract that. Sometimes this would select the wrong table such as if column are merged, SSRS will create yet another table to contain just that one piece of text so I had to add tags to the report to tell the app what to expect. All very messy.
The basic principle was to get SSRS to dump out a word file then our app would read thru it and extract the content, pasting it into a new document which was based on our Word Template.
If I had to repeat the process avoid doing what I did and I would concentrate on getting SSRS to output exactly what was required, matching the template design but this is only good if you don't have things like form fields etc as SSRS cannot produce these.
Word Automation is another option but that is slow or maybe look at some of the Apose renderers and see if they are of any use. ( https://www.aspose.com/ )
Sorry its not the answer you wanted but hopefully it will save you some time trying to figure it out.

Search function in plain HTML (No database)

This is likely the most ridiculous question I've ever had to ask but it's been a LONG time since I've ever worked with a static HTML site and I might not have had enough coffee this morning.
Can you have a search function on a static HTML site that does NOT have a database?
My client is migrating a site from ASP to HTML and they want to keep the search function on there but it literally is just a collection of static files. Nothing else. No Database, nothing.
Is this possible?
Do I need more coffee?
Well it's not possible using only HTML. However it's possible to create a search function without a traditional database. But still - the data needs to come from somewhere, if not a database then perhaps a txt or xml file. That said, it can be achieved using HTML+JavaScript if you don't want to involve a server-side language.
There are many tutorials on how to create these types of search functions using for example XML as a data source. Just google something like "XML HTML Search" and you'll probably find what you're looking for :)

How to: webpage equivalent of Excel pivot table

What should be the most straight-forward way (technology/framework/programing language) to get a webpage equivalent of an Excel Pivot table?
I have a table with raw data and I would like to be able to represent them as a pivot table depending on user choices/filters.
If possible it should be able to make some basic calculations (count, average, %) but if it would make things much more complicated, I can provide it already in the raw data (I don't know what is faster as webpage - calculating with smaller data or "just searching" with broader data).
Which technology shoud be the most appropriate for this kind of service (without being an overkill)?
Well, you could acheive this in more than 1 language (and you didn't mention using third party tools) so it's hard to recommend one over the other... Since you mentioning VBa I suspect VB.NET would be a good starting point.
Although you can embed Excel into webpages. Check out the Excel Web App
More details are here http://office.microsoft.com/en-gb/web-apps-help/introduction-to-excel-web-app-HA010378338.aspx
When you open your workbook in SkyDrive or SharePoint, Excel Web App
opens the workbook in the browser, where you can move around the
workbook, sort, filter, expand and collapse PivotTables, and even
recalculate the workbook.
Here is a general demo of it working: http://office.microsoft.com/en-us/excel/embed-an-excel-spreadsheet-on-a-web-page-FX102602477.aspx

How to get user submission to post to page

Hey guys... I'm working on creating one of my first websites and currently have it only in HTML/CSS which is great for displaying some basic material on my site. However, I'd like to add in the option to submit something basic like a quote to the page. I'd like to start with just a simple form to submit a name and a quote and have it appear in the quotes section. I've looked up basic HTML forms and such but I'm not sure how to go between a basic HTML form and having that material appear on the page. Could anyone help me step through this or perhaps point me to a guide to accomplish this?
Thanks.
You need a script which receives the posted information and some place to store the quotes. The script can be written in ASP.NET, PHP, python or whatever else your webserver supports and you want to learn. The database can be as simple as a directory with textfiles or a full-blown SQL database like postgresql or mssql.
When processing user-input you have to take care about security issues. The most common ones are:
Cross-site scripting: When you present user-input to the user, it must not be interpreted as HTML and/or Javascript, to prevent malicious users from sending information from your trust-domain to them.
SQL Injection: Always use the underlying database's parameter support to properly quote incoming data, to prevent malicious users from sending arbitrary commands to your database. See also this example.
as a java developer the way I would do this is:
get the information from the html
using JQuery
than I would just a post to send to
the servlet
process what i need in servlet
send back to JQuery the answer
change my html with JQuery
Although I am sure there are much easier ways to do it with just PHP
if you want to do this way, first thing i would master is making sure you can send things to the servlet and get an answer back.
look at this and see if you can get something to get sent back
http://www.roseindia.net/servlets/HelloWorld.shtml
It might be a good idea to also look at JSPs
http://java.sun.com/products/jsp/html/jspbasics.fm1.html

Sharepoint - Can You Output Unfiltered HTML from a Database?

Our customers have asked for Sharepoint and, of course, we are having to implement features for which Sharepoint wasn't really designed. We are first trying to stretch the in-house webparts as far as we can, so we are doing a lot of the work in stored procedures, user defined functions, and custom views in the MSSQL DB.
I am generating html links from fields in the database and wish to display them in something like a Data View web part. Of course, all of the data being displayed is being filtered so that it shows up as unrendered HTML. Is there a way around this?
Alternatively, is there any type of web part that can connect to another webpart or Data source and display unfiltered text/html from that source?
You need to use the XSLT in the dataview webpart to control the rendering.
You have full control over what html is created. disable-output-escaping if necessary.
I get a feeling you’re customizing SharePoint the wrong way. Either that your I don’t really understand the description of your question. I would appreciate a more detailed description of exactly what you are trying to accomplish.
As far as I know you should NEVER touch the SharePoint database directly. I think you should focus on creating lists, field types, WebParts and whatever SharePoint components you might need; instead of messing around in the content database.
SharePoint got a decent development API. It takes some time to learn, but in the end it’s probably worth it.
You can connect your custom made WebParts in SharePoint, here is a sample.