How do I insert HTML to a onenote page using VBA - html

Background
I use Onenote at work like a scrapbook, keeping track of assigned tasks and my progress through those tasks. Tasks are assigned via an automated email (outlook) typically these tasks involve manually reading web pages and filling in other webpages with results.
So far I've used the email arrival to trigger a VBA script which use uses data in the email to save the "requirements.html" page and the "ingredients.html" page locally. I then use python to parse and do some initial verification on the ingredients.html. This results in an augmented "requirements.html" containg colour coded status of parts.
my question
I've pretty much cut'n'pasted this code and managed to add a new page to section X of notebook Y (where x and y are strings passed to the function) or creating a new section by copying section.one file into the notebook folder DEST = "C:\Documents and Settings\Me\My Documents\OneNote Notebooks\Tasks\" + rqst_section + ".one"
while the code adds plain text to the page adding raw html source code in place of the plain text results in a object error when line
oneNote.UpdatePageContent doc.XML
is executed.
Has anyone managed to get the same result using VBA as this manual sequence,
select all text in browser window and copy 'n' paste it into a page in onenote.

I was getting a "UpdatePageContent" in "IApplication" failed error message, found out I had a Form Feed (chr(12) or vbFormFeed) character in a textfile I was trying to insert text into a page. Stripped that out and everything else seemed to work fine. Run the offending data through a hex editor, or strip it down little-by-little until you find the problem area.
Hope this helps.

Related

How to add dynamic data in an HTML document via a Power Automate flow?

I'm working on a flow to take data from a SharePoint list, and add it to a specific point in HTML. I am just saving the outputted HTML file to my OneDrive whilst testing.
I have found that when pasting my HTML code into a compose block, then outputting this, it works fine and I'm left with a normal looking HTML page when opened in a browser.
However, as soon as I add dynamic data in place of certain HTML elements it all seems to go wrong.
Firstly, the outputted HTML file now contains '/n' in place of every line break. I have also noticed that the outputted HTML code has now been changed to an array.
I've attached screenshots of my flow below.
Get Items:
Compose:
Create File:
Create File Peek Code:
Compose Output:
Create Output:
Create Output Raw:
Outputted HTML File:
Are you processing the output from that Compose action?
What you are doing is correct and it would not matter if you are using a single or multiple lines of text.
It seems to me that you are using the output of the compose somewhere else or maybe the file content box in the OneDrive action has an expression?
Please check the following:
The output of the compose should look normally
Make sure your OneDrive's action parameters look like this when you "Peek code" (Click on the action's ellipses). If it looks different, you'll have to track the variable/output you are using or review the expression.
I have replicated what you are doing and it is working fine, see attached images.
Edit mode:
Run:
Compose action
OneDrive action
Created File in OneDrive:
EDIT: Update response to use the result from SharePoint in two different ways.
Use the OneDrive action inside the 'Apply to each' if there is only 1 result, it will run once anyway.
You can omit the 'Apply to each' action using the expression box to set the values in the Compose, this is the syntax you can use.
outputs('Get_items')?['body']?['value']?[rowIndex]?['ColumnName']
In case there are several rows in the result, you'll have to validate which is the one you need.

Pubishing to rpubs existing html file

I am trying to publish to rpubs a html file generated from a rmd using knithtml. However, the knitting takes too long to run and i would not want to rerun the whole knit process again just to make minor changes to the appearance of the html document.
I cannot seem to find the publish button the moment i close the html file and reopen it again.
Install the package markdown then you can try the code:
result <- rpubsUpload(title='Your title',htmlFile='your_html_file_and_path.html',method=getOption('rpubs.upload.method','auto')
A successful upload would return 2 values in result, which are website addresses. Copy and paste the continueUrl into your browser to complete the upload.
Or you can use the function:
browseURL(result$continueUrl)
to go straight the webpage using the default browser.
Note that I am sure there is an automated way of uploading without using the browser but this is the only way I know right now.
Execute Following Commands- First set the PATH then execute other commands
setwd("C:/Users/MK10181/Desktop")
result <- rpubsUpload(title='SPC',contentFile='Report.html', originalDoc = 'Report.html')
result
$id
[1] "https://api.rpubs.com/api/v1/document/507696/c26dc92b5fe046488a4bfa8c670dab26"
$continueUrl
[1] "http://rpubs.com/publish/claim/507696/dc025c9952da401db86aef1f0f234734"
browseURL(result$continueUrl)
After this Your RPub's accounts page will open in the browser then you will see your document.

No Google BigQuery table created after importing data through webclient

I'm currently familiarizing myself with Google BigQuery by working through the examples at https://cloud.google.com/bigquery/web-ui-quickstart. Doing a query over the pubic datasets runs fine.
I run into problems when uploading custom data into a new table through the WebUI. I create a new dataset and table, and upload the csv file provided with the example case. As in the example I input the schema and submit the file. Now the upload window stays on top and turns grey as if it's working. Nothing seems to happen afterwards though. When clicking away the upload window after a long wait, the table seems to be created in the tree on the left. However, when clicking on the table an error is shown:
"Unable to find table: ndwtest-984:csvtest.csvdata"
This seems like a trivial action, however I cannot seems to get it to work. I've tried varies different files, uploaded the file to Google Cloud Storage first and played around with the advanced options the last two days, but keep getting the same error.
Help would be much appreciated.
Some steps to help you:
billing must be enabled
you need to choose to upload one single TXT file from the example eg: yob2013.txt and not the zip file
make sure the schema is entered as text: name:string,gender:string,count:integer
on the last screen of the wizard you don't need to change the default CSV option parameters (for demo purposes works as it is)
I just tried the example, and it does work for me. In case you still have errors, than you can check your Job History menu in the Web UI, direct link would be, warning you need to put your Id in the link.
https://bigquery.cloud.google.com/jobs/YOUR_ANONYMOUS_PROJECT_ID_HERE?pli=1

Exporting Oracle APEX regions with DBMS_LOB

I'm interested in exporting the contents of a page generated by Oracle-APEX to an external file while preserving as much formatting as possible. Eventually, I'd like to export it to either a .doc, .xls., or .pdf format. For now, I'm testing with a .doc file.
Currently, I'm attempting to do this by creating a PL/SQL anonymous block "Process" that executes when an "Export" button is pressed. Based off an example I found online, if I use the following code in the process, I can output one of the items in my page to a .doc file:
DECLARE
test_blob BLOB;
BEGIN
dbms_lob.createtemporary(test_blob, FALSE);
dbms_lob.open(test_blob, dbms_lob.lob_readwrite);
DBMS_LOB.APPEND(test_blob, UTL_RAW.CAST_TO_RAW(:P4016_ITEM_NAME));
OWA_UTIL.mime_header('application/doc', FALSE);
HTP.p('Content-Length: ' || DBMS_LOB.getlength(test_blob));
htp.p('Content-Disposition: attachment; filename= "text.doc"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file(test_blob);
dbms_lob.close(test_blob);
END;
However, I would like to output some regions on my page that include tables, which are not considered items, as far as I know (I'm still very new to APEX). If I include the table name in the DMS_LOB.APPEND line, I receive an error message. Does anyone know of a simple way to reference these regions?
The only workaround I've found is to replicate the page in my exported file by enclosing the results of the SQL queries used to populate the tables in HTML based off the HTML of my APEX Page. In other words, if I wanted to italicize something, I would do the following:
...
dbms_lob.append(test_blob, UTL_RAW.CAST_TO_RAW('<html><i>'));
dbms_lob.append(test_blob, [PARSED SQL QUERY]);
dbms_lob.append(test_blob, UTL_RAW.CAST_TO_RAW('</i></html>'));
If anyone knows of a simpler way to do this, preferably involving a simple reference to my page regions, I would greatly appreciate it.
There is a way (3 ways) to get PDF - http://www.oracle.com/technetwork/developer-tools/apex/learnmore/custom-pdf-reports-1953918.pdf.
Also you can use Interactive report, it has export option. But it can be exported only in HTML by default.
It is not exactly what you ask, but you don't need to write code.

Matlab gui for selecting a text file and the utilize it in further code

I have spent a long time studying about the gui. I have made the blank template containing all the buttons and input editable text box. but am facing problem with callback functions.
I have written a code which requires manually entering the text file containing data into the script file and then input a variable's value (in this case 'b') which is then utilized in the later part of the code. i wanted to make the program more user friendly so that one can select the text file from any directory by pushing a button and can change the value of b in a box provided. Also I have not included any functions in the main code...so its a basic data fitting code.
I tried studying about gui in matlab and other resources but am not able to understand it and use it. Therefore i cant put any of my work done uptill now. Please help me in solving the problem..
You may create a button in your GUI and include the following code in the associated callback function:
[aux_file,aux_path]=uigetfile();
if ~isempty('aux_file')
handles.data.file_name = fullfile(aux_path,aux_file);
handles.data.file_data = load(handles.data.file_name);
guidata(handles.figure_window, handles);
end
Now, you can use the data in other functions.