How do I write to excel and have images

Get help using Construct 2

Post » Fri Jun 03, 2016 9:27 pm

HI,

I've been making a pricing tool app for a little while now and pretty happy with how it is working. I am currently using AJAX / a .xml file to open, write values from global variables and saving the app data into a summary table. Trouble is that this means I cannot setup any picture files as these are lost when saving as xml. Does anyone know a workaround?
B
38
S
11
G
1
Posts: 204
Reputation: 4,477

Post » Fri Jun 03, 2016 10:52 pm

You could store the image files on a server, and have them imported when you run the app.
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Sat Jun 04, 2016 6:19 am

Hi @emoaeden,

Thanks for helping. Would this mean keeping my xml file as it is and then in C2 placing the image into the file?

At the moment my app has rows of list boxes / text files where you select items, it loads up the prices and it gives a summary on sheet of the totals. When you 'build' it calls a pre setup .xml file from project files and uses the filecontents replace action to export these via a global variable. Would it be at this stage? Or would it still loose the image?

With my tests / looking online so far I have read that xml cannot save with images hence they disappear when you save. Some sites talk about converting it into base64 code but I was unsure how to implement this.

Cheers,
B
38
S
11
G
1
Posts: 204
Reputation: 4,477

Post » Mon Jun 06, 2016 11:00 am

You are right. What you should do is store the images on a server (let's use dropbox for example). Then have the address in the .XML that calls dropbox.com/user/1234/photos/1.jpg for the first item, dropbox.com/user/1234/photos/2.jpg for the second item, etc

Then have the app pull/import the image that is at that address.
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Mon Jun 06, 2016 5:46 pm

@emoaeden

Thanks, I'll have a look and a play around. If you know any examples that would be helpful. Excel is the output my app makes at the moment so I am hoping for a way that when I send data from my app to the .xml file I can also have a picture in the xml file, suitable to be opened in excel afterwards.

Thanks,
B
38
S
11
G
1
Posts: 204
Reputation: 4,477

Post » Thu Jun 16, 2016 5:18 pm

I've still been unable to do this so bumping incase anyone can help.

Ideally I'd like to save as an .xls file but the methods I know in c2 only let me save to .xlm

Any help will be greatly appreciated :)
B
38
S
11
G
1
Posts: 204
Reputation: 4,477

Post » Sat Jun 18, 2016 7:23 pm

xml is a text format so I don't think you can get excel to load it with images. If you're doing it for your own format you can use something like canvas.asUrl to get a text version of an image that you can load into a sprite or something later, however excel will not understand that.

You can either figure out how to generate the xls files from the format spec:
https://msdn.microsoft.com/en-us/librar ... =office.14).aspx

or maybe use some js library to generate it:
Maybe this?
http://excelbuilderjs.com/
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Sun Jun 19, 2016 8:06 am

@R0J0hound

Thanks for the reply. I think the first link is broken but I will look into the second option.
B
38
S
11
G
1
Posts: 204
Reputation: 4,477

Post » Tue Sep 13, 2016 6:24 pm

Hi,

So I am still stumped on this one and thought I'd chuck another shout out to see if anyone can help. Sorting images into my excel output is the last part of finishing my 'quote' app and I am hoping it is possible in some manor!

Thanks,
B
38
S
11
G
1
Posts: 204
Reputation: 4,477

Post » Tue Sep 13, 2016 6:34 pm

This sound alot like doing impossible things like breathing in space. I have a few question is there a way to make the app store save the image as a file in the host computer file system and then force import it as a file into the app. Through some Ajax fancy magic ? If so then it should it be matter of saving the image file to the host device through its own file system or to force create a folder in their system for your app and then have it save the image to there. Or least that what ive observed from other professionally made app.
B
52
S
24
G
6
Posts: 391
Reputation: 7,855

Next

Return to How do I....?

Who is online

Users browsing this forum: warmty and 6 guests