Office add-in, turn html image into an insertable image - office-addins

If I have an image inside the add-in HTML, in what way I can make that image available for used in an Office app itself? Such as, when the user click on the image inside the add-in frame, the same image should be available outside of the add-in frame.
Update: For Powerpoint please (I wasn't aware of the inconsistency of the API across Office applications)

If the image is hosted somewhere publicly, you can insert it with the Range.insertHtml() method. Alternatively, if the image is constructed dynamically in a base64-encoded file, you can insert it with the Range.insertFileFromBase64() method.
If you'd like the add-in to also work in Office 2013, you can insert images using the Document object.
-Michael (PM for Office add-ins)
Update: For PowerPoint specifically, the Range object is not available but you can still insert images with the Document object: call setSelectedDataAsync with the Image coercion type.

Related

Images in Google data studio dashboard working for editor but not working for viewer

I use google form to collect images. The images are stored in a folder in google drive. The folder is shared publicly so that all the photos within the folder are also public if the link is available. The responses are stored in google sheet and converted to a accessible file that i.e. change from "https://drive.google.com/open?id=" to "https://drive.google.com/uc?id=" so that images are directly accessible. The google sheet is connected with google data studio. I need to show these images in the data studio dashboard. What I could find as solution was to create a table with the image URLs. Using a table, I've tried to do the following
Created a new field in google data studio and added image function with a link as mentioned above.
Instead of creating a new field, changed the type of image URL column to URL as well as image.
Both above are working for me as an editor (during edit or view as shared in below images. But when I share the dashboard as a link and view it in incognito mode, it is not working. I hope I'm able to explain.
Google Form Link: https://forms.gle/FFjX7cV8tJUSx5GW9
Google sheet where data is collected : https://docs.google.com/spreadsheets/d/1glpAId0LHgTUUtVk3RwakDr-H1KUXk3WtA-SE50HKXQ/edit?usp=sharing + also Embedded in google data studio
Google Data Studio link: https://datastudio.google.com/s/oaCN4EO-J4c
Its working for me as editor, but as a viewer in above link, its not working as visible in above data studio link
But as a viewer (incognito mode) images are not visible.
Actually, the images work for any user logged into its own Google account. The problem is really experienced when the dashboard is open with no logged user.
Diving into the problem, it seems to be related with the number of redirects that Google Drive need to access the image. Reproducing your dashboard I was able to see the error ERR_TOO_MANY_REDIRECTS in browser's Dev Mode.
Steps in logged mode:
Access https://drive.google.com/uc?id=[id]
302 Redirect to https://*.googleusercontent.com/docs/
The image is returned
Steps in non logged mode:
Access https://drive.google.com/uc?id=[id]
302 Redirect to https://*.googleusercontent.com/docs/...
302 Redirect to https://docs.google.com/nonceSigner?...
The image is returned
If you look into Dev Mode, it is possible to note that the URL ended with "/nonceSigner" is accessed dozens of times when not logged (the same does not happen when logged). This means that Data Studio start a loop trying to access the image, which triggers a "retry" operation when it sees a double redirect.
Curiously, this does not happen when using the standard Image control (instead of table chart, that reads from a DataSource), so it seems to be a bug in the Table chart component.
So you're out of luck. My suggestion is to use Cloud Storage instead of Google Drive, since it seems you're using some undocumented features and they'll surely break at some time.
Another option is to report this bug to DataStudio team (report here). There are Data Studio developers that activelly answer questions in StackOverflow (like Minhaz Kazi), so try to drive their attention to this issue.
I was having a related issue here - a colleague was not able to view images in a data studio dashboard, even though he was able to view the same files directly in Drive. It turned out to only be a problem using the Brave browser! I can't figure out what exactly was going on, but posting here in case it helps someone else.

Mabox Outdoors custom style with Mapnik

I am trying to set up a tile server with Mapnik, renderd, mod_tile and with MapBox Outdoors style. I've been able to successfully go through https://switch2osm.org/serving-tiles/manually-building-a-tile-server-14-04/ tutorial and set up the server with OSM-Bright style.
Next I changed renderd.conf file and pointed the 'XML' property the 'project.xml' file from MapBox Outdoors style which I previously downloaded from Github. I've also cleared the cache, restarted renderd and apache but the new style does not work - there are only empty tiles rendered.
Is there something that I'm doing wrong? What is the proper way to apply Outdoors style?
The Mapbox Outdoors style is not compatible with the OSM Bright process described by switch2osm. It is designed to be uploaded to a Mapbox account, not to be used with a custom mod_tile setup. The style as-is relies on data in the form of vector tiles served from the Mapbox API (which requires an account / API key and is subject to certain conditions).
It would be possible to modify the source code to work with a custom database for you to use it in your own tile server setup, but you would need to make sure your layer definitions are compatible with the descriptions at https://www.mapbox.com/developers/vector-tiles/mapbox-streets/ and https://www.mapbox.com/developers/vector-tiles/mapbox-terrain/.

Aspose PDF viewer

I am using the Aspose PDF tools and have successfully got it to print the pdf which is great, but ideally I want to be able to add a wpf control to display this as well.
I would have assumed that the PdfViewer class would have something, but I can't tell.
So far I have needed to use a different control MoonPdfPanel which is annoying as I would have preferred 1 tool to do both jobs.
Does anyone know of a control I can use to hook into the aspose?
Thanks
We have developed an HTML5 PDF Editor application using Aspose.Pdf for .NET API which you can use in your application as a PDF Viewer as well. You can get the details and complete source code here. You can use the source code to edit the viewer as per your requirement.
P.S. I am working as social media developer at Aspose.
Well, if you are interesting in viewing the PDF file, you may convert the file to HTML and display it using an IFrame in your application. I have developed a sample application which performs different operations including viewing a PDF file in IFrame. Download it and try it at your end. Another option is that you can convert the PDF file to images and display in Imageviewer in your application (Code is available in the above application).
P.S. I am working as social media developer at Aspose.

Download image from silverlight webpart in sharepoint2010

I want to download a image from any URL through silverlight webpart in Sharepoint 2010.
I am able to download image from the same site, but not from other ones (within the same server itself).
I am using WebClient class and opening the image file asynchronously.
Please suggest some ways to achieve this.

Help for using (exernal images) from the website with SSRS

I have a small web site where i maintain users data. I maintain the users data in table and store there images like /images/users/user_id.jpeg on the server.
I am using the ReportViewer control in the asp.net page to show the reports from SSRS in the web application.
Now user want reports where they can see the users image in the report so that they can export it as pdf and get it printed.
In report i tried html image tag with full and relative url with option to render HTML however its not working. Also i tried the image control in the toolbox with external url and that too appears to be now working.
Can someone please help me get around this problem or guide me to some helpful links.
Thanks all,
It will be a lot easier to set up the report so that your users can see the image, if you can see the image in preview in Report Designer.
Make sure you have a working URL that takes you to one of your images. Test it, by pasting the URL into the address bar of your browser and ensure that the image is displayed in the browser.
Delete the existing image from your report. Insert a new image into the report object (normally a list or table) you are using to display your table. (This should be where the old image was.)
Specify Web as the image source, and enter your working URL as the URL of the image.
Preview the report in the report designer. You should be able to see the image (with the hardcoded URL) displayed correctly in the report.
Assuming all images are stored in the same directory on your server, switch to the layout tab of your report designer and click on the image object. In the Properties window, the value attribute should be the harcoded URL.
Click on the <Expression...> option from the dropdown menu for the Value attribute. Edit the expression so that it says ="your URL, without the filename" & Fields!your image filename data field name.Value
Preview the report in the report designer. You should be able to see the appropriate image for your data displayed correctly in the report.
If everything has gone correctly up to this point, deploy the report and try viewing it in the Report Manager. You should be able to see the appropriate image for your data displayed correctly in the report.
At this point, your users should now be able to see the report images.
I tried everything!!! It wasn't working in BIDS, Web Browser nor a Winform Report Viewer control.
I ended up hard-coding the image and it still didn't work:
="http://MyServer/Reports_SQL2008/Pages/Resource.aspx?ItemPath=%2fProjectReporting%2fBRAND_Logo.png&RetrieveResource=True"
I am pretty sure the problem was something to do with Active Directory Group Policy propagation. I suggest to leave it overnight if you have the same problem and have tried everything you can think of:
Setup Unattended Execution Account in SSRS Config with a service account who's password wont expire:
Permissions (both on image and also at Site Settings):
Can navigate to the image successfully, but it still doesn't show in the report.
Have the SSRS Image Properties set correctly, with the equal sign and url enclosed in double quotes, ie: ="url"
Even clear your browsers cache and tried different browsers, etc, etc
Anyway next morning I tried and the hardcoded path works and now this dynamic URL works too:
http://MyServer/Reports_SQL2008/Pages/Resource.aspx?ItemPath=%2fProjectReporting%2f" & First(Fields!Brand.Value, "ClientAndBrandByAccount") & "_Logo.png&RetrieveResource=True"
The XML in the RDL file is HTML encoded and looks like this:
<Image Name="Logo">
<Source>External</Source>
<Value>="http://MyServer/Reports_SQL2008/Pages/Resource.aspx?ItemPath=%2fProjectReporting%2f" & First(Fields!Brand.Value, "ClientAndBrandByAccount") & "_Logo.png&RetrieveResource=True"</Value>
I tried to make the Server URL dynamic as Alex Z shows, though I had to use this Replace code:
=Replace(Globals!ReportServerUrl,"/ReportServer_","/Reports_") & "/Pages/Resource.aspx?ItemPath=%2fProjectReporting%2f" & First(Fields!Brand.Value, "ClientAndBrandByAccount") & "_Logo.png&RetrieveResource=True"
Create a relative url using the expression and global variable Globals!ReportServerUrl
= Globals!ReportServerUrl + "your path to image"

Resources