none
How to retrieve images from Database? RRS feed

  • Question

  • I am trying to make a PowerPoint add-in that simply allows a user to select images from a list of images. This is very similar to the Add-In commands tutorial video found below (at about the 2:15 mark):

    https://channel9.msdn.com/events/Build/2016/P551

    Specifically, I want to perform the same type of operation (but with my own images) as the add-in demoed in the video.

    What is the best method to display images from a database with Javascript? Can I use Microsoft Azure to store and retrieve these?


    Sunday, September 11, 2016 4:05 PM

Answers

  • Hi Lucas Crawford,

    when I try the link on my side its working you can see it in the picture mentioned below.

    you can try this url.

    Pickit

    you had mentioned that you don't want to share the image publically and only those who purchased the Addin should be able to download the images.

    so for that you can make a login in your addin.

    so that only who had purchase the Addin only have the username and password.

    so no any other person can login in your addin to download the image.

    I can understand your requirement but it is not currently available to fulfil using directly Office Addin.

    so if think that this feature should be available in Office Addin then please give your feedback to Powerpoint User Voice. because you want to develop the Addin for powerpoint.

    Powerpoint User Voice

    Regards

    Deepak   


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 29, 2016 4:27 AM
    Moderator

All replies

  • Hi Lucas Crawford,

    you can try to load the webpage in the task pane and with in that web page you can try to fetch and display the image.

    instead of directly show the image in task pane.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 14, 2016 9:24 AM
    Moderator
  • Deepak,

    Thank you for your response. However, I do not want to use an image hosting website such as Imgur, etc.

    I need to store these files securely on an actual database and retrieve them via the taskpane. How can I accomplish that? I would really prefer to utilize Azure if possible.

    Wednesday, September 14, 2016 10:38 AM
  • Hi Lucas Crawford,

    you are trying to develop in Office Addin. so you need to use javascript Api.

    currently JavaScript Api has limited features and functionality.

    so we can not able to achieve your requirement properly.

    so you can try to fetch the images in html code and try to display in task pane.

    if you try to develop VSTO Addin then you can try to generate Image place holders dynamically and with C# or VB.net you can easily fetch the images from the database and try to assign the images to image place holder in task pane.

    also if possible then you can just try to store the image path in the database and store the image in one folder.

    if you store the path then database will occupy less storage.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 15, 2016 8:35 AM
    Moderator
  • >>>If you try to develop VSTO Addin then you can try to generate Image place holders dynamically and with C# or VB.net you can easily fetch the images from the database and try to assign the images to image place holder in task pane.

    also if possible then you can just try to store the image path in the database and store the image in one folder.

    if you store the path then database will occupy less storage.

    ----------

    Can you direct me to an example of how I can "easily fetch images from the databse"? Note I have no experience with VSTO add-in development.


    Thursday, September 15, 2016 10:14 AM
  • Hi Lucas Crawford,

    in my last reply I suggest you to develop VSTO Addin and in your last reply you had asked about some tutorials regarding it.

    but here I want to clear something first.

    Office Addin and VSTO Addin both are Different.

    in the original post you had asked the question about Office Addin but Currently JavaScript Api is not so much powerful so it is difficult to achieve your requirements with that so I suggest you to go with VSTO Addin.

    because with VSTO Addin you can work with C# and VB.net so its easy.

    but this type of Addin will not supported in Online office or on multiple platforms.

    so first I suggest you to check the difference between Office Addin and VSTO Addin.

    Otherwise you will get the wrong direction.

    then also if you want to develop VSTO Addin then I will try to provide you some tutorials.

    Regards

    Deepak 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, September 16, 2016 10:56 AM
    Moderator
  • Thank you for the clarification.Yes, please go ahead and send me the VSTO Addin tutorials.

    Also, can you please link me the direct links to both development platform homepages:

    • Office Addin
    • VSTO Add

    I need to understand the specific differences between the two.


    Friday, September 16, 2016 1:16 PM
  • Hi Lucas Crawford,

    First you can try to check the code mentioned below which you can use to load the image in Addin from the database.

            private void UserControl1_Load(object sender, EventArgs e)
            {
                SqlConnection cnn;
                string connectionString;
                connectionString = "Data Source=servername; Initial Catalog=databasename; User ID=sa; Password=password";
                cnn = new SqlConnection(connectionString);
    
                MemoryStream stream = new MemoryStream();
                cnn.Open();
                SqlCommand command = new SqlCommand("select imgdata from demodata", cnn);
                byte[] image = (byte[])command.ExecuteScalar();
                stream.Write(image, 0, image.Length);
                cnn.Close();
                Bitmap bitmap = new Bitmap(stream);
                pictureBox1.Image = bitmap;
    
            }

    Here below are the links for the both type of Addins.

    Getting Started Programming VSTO Add-ins

    Create VSTO Add-ins for Office by using Visual Studio

    Office Addins:

    Get started with Office Add-ins (formerly Apps for Office)

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, September 20, 2016 3:28 AM
    Moderator
  • >>>in the original post you had asked the question about Office Addin but Currently JavaScript Api is not so much powerful so it is difficult to achieve your requirements with that so I suggest you to go with VSTO Addin.

    ----------

    You mentioned that it is simply "difficult" to accomplish my goal via Office Add-ins which eludes to that it may still be "possible."

    Can you please point me to an article that specifically discusses these types of limitations when comparing VSTO Add-ins and Office Add-ins? The purpose of Office Add-ins is to use HTML, CSS and Javascript to keep development simple. Adding C# and VB on top of those languages makes the project that more complex.

    Thank you for your continued assistance.

    Tuesday, September 27, 2016 2:34 PM
  • Hi Lucas Crawford,

    As per your requirement here I understand that best way is to display the content from the web page.

    you had gave an example of Pickit Addin.

    if you see that addin again then it also showing the contents from the webpage.

    when you right click on addin it will show you the option for Reload and view source.

    if you click on security then you will get the name of the webpage in messagebox regarding SSL.

     

    if you visit the this url then you will get a same web page that you get in task pane.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 28, 2016 7:05 AM
    Moderator
  • >>>you had gave an example of Pickit Addin.

    if you see that addin again then it also showing the contents from the webpage.

    ----------

    Regarding the Pickit example, this was made via Office Add-in and not VSTO, correct? When I try to visit that Pickit URL, there is a 404 error: https://pickit.com/static/0365/task_pane_app/index.html

    Also, what web-hosting options do I have to keep my photo content private? I do not want these images publicly availble on the web; only for users that have purchased this add-in within PowerPoint. This is why I wanted to use a database option via Office Add-in.

    Wednesday, September 28, 2016 9:40 AM
  • Hi Lucas Crawford,

    when I try the link on my side its working you can see it in the picture mentioned below.

    you can try this url.

    Pickit

    you had mentioned that you don't want to share the image publically and only those who purchased the Addin should be able to download the images.

    so for that you can make a login in your addin.

    so that only who had purchase the Addin only have the username and password.

    so no any other person can login in your addin to download the image.

    I can understand your requirement but it is not currently available to fulfil using directly Office Addin.

    so if think that this feature should be available in Office Addin then please give your feedback to Powerpoint User Voice. because you want to develop the Addin for powerpoint.

    Powerpoint User Voice

    Regards

    Deepak   


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 29, 2016 4:27 AM
    Moderator
  • Understood. I have a question about getting these images displayed properly via Office Addin like Pickit.

    Per the below code, I can successfully input a picture into the task pane via a button. However, I cannot get that same picture displayed in the PowerPoint slide. I get an error: "This image cannot be displayed."

        //Insert Image into Task Pane - Success
        function getImg3()
        {
            var img3 = new Image();
            img3.src = "https://cdn.seoservices.expert/wp-content/uploads/2015/03/google-ssl.jpg";
            document.body.appendChild(img3);
        }
    
        //Insert Image into PowerPoint slide - Failed
        function getImg4() {
            var img4 = "https://cdn.seoservices.expert/wp-content/uploads/2015/03/google-ssl.jpg";
            return img4;
        }

    What do I need to modify in the second function to make this work properly? Is there a different append() function I can utilize?



    Sunday, October 2, 2016 11:21 AM
  • Hi Lucas Crawford,

    Here I think that your original issue regarding developing an Addin like Pickit using App for office is cleared now.

    here in the last post you had asked another new question.

    I think that this is a separate question and not related with the original issue.

    so here I suggest you to create a new thread for every new question instead of continue in the old question.

    so you can create a new thread and you will get solution there.

    Regards

    Deepak 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 3, 2016 3:15 AM
    Moderator