the picture is stored in your BLOB field. so you must export the blob to a directory and in EXCEL import this File.
You know how you can open an excel Worksheet with excel automation:?:
If not search the forum for this.
Here an example to add a picture into word.
calcfields(YourBLOBField);
IF YourBLOBField.HASVALUE THEN BEGIN
YourBLOBField.EXPORT(FilePathAndName); //or your fileextension
xlSheet.Shapes.AddPicture(FilePathAndName, 1, 1, 20, 20, 100, 100);
END;
You know how you can open an excel Worksheet with excel automation:?:
If not search the forum for this.
I've just been using table Excel Buf to create an Excel file off reports.
calcfields(YourBLOBField);
IF YourBLOBField.HASVALUE THEN BEGIN
YourBLOBField.EXPORT(FilePathAndName); //or your fileextension
xlSheet.Shapes.AddPicture(FilePathAndName, 1, 1, 20, 20, 100, 100);
END;
I'm assuming the xlSheet is an automation? What specific automation is this? I don't have much experience on this specific automation but I know what they are, and I know how to use automation. Thanks for your help and have a great weekend.
Utilizing the MSXML automation yourself may save you time and effort in regards to this situation. Although I am not sure if you can import an image (Object) to Excel directly via Stream (I will look into this) but you can do so with the code provided by garak.
(If you do decide to use the automation check out my post 'Export to Excel with Performance' on creating faster Excel exports if you have a fair amount of data you wish to export (and are displeased with the time it takes to generate the document using Excel Buffer or anything else.))
Utilizing the MSXML automation yourself may save you time and effort in regards to this situation. Although I am not sure if you can import an image (Object) to Excel directly via Stream (I will look into this) but you can do so with the code provided by garak.
(If you do decide to use the automation check out my post 'Export to Excel with Performance' on creating faster Excel exports if you have a fair amount of data you wish to export (and are displeased with the time it takes to generate the document using Excel Buffer or anything else.))
I haven't gotten the chance to play with your coding as I'm in a time crunch... I do have some specific questions:
What specific automation is this? How do I relate it to the excel file I'm building with the Excel Buffer table? At this point, I'm still building the rows & columns. I still haven't issued the createbook function.
If you are still at the beginning stages of planning the export I would suggest taking a brief look at my code.
The MSXML automation you will find is labeled 'Microsoft XML, v#.0' where # (the version) is entirely dependent on which Microsoft Office or MSXML "Core Services" you have installed. (You can easily download/install the latest version of MSXML free of charge whether or not you have Office installed.)
The two main issues I foresee you possibly running into is:
A) Primarily not being able to import your image to the Excel document you are creating through 'Excel Buffer' (Contains no function allowing Image importation)
The time in which it takes for Excel Buffer to construct your Excel document (since it makes references Cell-By-Cell and slows the process down greatly)
I'm actually trying to put a document with a logo (i.e., Sales Order Confirmation) to Excel. I know. it does not make sense but my customer just loves Excel. I'll have to play with your code tonight and see where that leads me. I can't study it right here at the customer site. If you have any more tips, please let me know. Thanks.
In your case, since the Excel document is most likely going to be rather small, you could benefit from making an additional function in Excel Buffer (if you have the access)
The code "garak" provided should work for you. We use the same in a solution we created. Export the blob to your temp folder and add the shape in excel.
An other approach is; Use a template excel sheet in which the logo is already inserted. Open this, put your data in and save as ...
The code "garak" provided should work for you. We use the same in a solution we created. Export the blob to your temp folder and add the shape in excel.
An other approach is; Use a template excel sheet in which the logo is already inserted. Open this, put your data in and save as ...
I got the blob stored in a temporary folder. However, I'm missing one more step. This might sound like a really dumb question... how do you add the shape in Excel via code in Navision? :oops:
now the situation has arrived at a particular juncture where you can niether swallow nor spit as we all want an optimal solution that is to be "desired".
Thanks & Regards Santosh Where Stones can be transformed to Gold
now the situation has arrived at a particular juncture where you can niether swallow nor spit as we all want an optimal solution that is to be "desired".
And where is there the Problem with "Excel Buffer" :?:
The Function CreateSheet() in "Excel Buffer" table generates the Shape.
So where is the Problem ? New Function in this Table Like
SetPathToPicture(PicturePath:Text[1024])
Here we store in a global variable the Path
FilePathAndName := PicturePath;
in function CreateSheet() we check the Value of the variable FilePathAndName and check if folder and file exist. if both is true, we import the Picture in our shape.
CreateSheet()
....
....
//New Code +++++++
if (FilePathAndName <> '') and (Exists(FilePathAndName)) then
XlWrkSht.Shapes.AddPicture(FilePathAndName, 1, 1, 20, 20, 100, 100);
//New Code ------------
.....
.....
I'd like to be able to export a blob to excel using the excel buffer table.
I read the solution proposed by garak but I think I'm missing something.
Let's assume that I want to export X items from the inventory to excel.
Each item has a custom field to store the blob for the image.
I would like to have the image in row 1, column 1, and then the no. of the item just under it, row 2, column 1.
I then skip 2 lines, and I do the same with item #2, and so on, until I reached item #X.
The way I understand the excel buffer table is that you enter a record for each value you want to send to excel, and at the end, you call the createsheet function to create the worksheet. Creating a new function to set the path of the image isn't working as I have multiple blob to export to excel.
Comments
You know how you can open an excel Worksheet with excel automation:?:
If not search the forum for this.
Here an example to add a picture into word.
Regards
I've just been using table Excel Buf to create an Excel file off reports.
calcfields(YourBLOBField);
IF YourBLOBField.HASVALUE THEN BEGIN
YourBLOBField.EXPORT(FilePathAndName); //or your fileextension
xlSheet.Shapes.AddPicture(FilePathAndName, 1, 1, 20, 20, 100, 100);
END;
I'm assuming the xlSheet is an automation? What specific automation is this? I don't have much experience on this specific automation but I know what they are, and I know how to use automation. Thanks for your help and have a great weekend.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
(If you do decide to use the automation check out my post 'Export to Excel with Performance' on creating faster Excel exports if you have a fair amount of data you wish to export (and are displeased with the time it takes to generate the document using Excel Buffer or anything else.))
I haven't gotten the chance to play with your coding as I'm in a time crunch... I do have some specific questions:
What specific automation is this? How do I relate it to the excel file I'm building with the Excel Buffer table? At this point, I'm still building the rows & columns. I still haven't issued the createbook function.
The MSXML automation you will find is labeled 'Microsoft XML, v#.0' where # (the version) is entirely dependent on which Microsoft Office or MSXML "Core Services" you have installed. (You can easily download/install the latest version of MSXML free of charge whether or not you have Office installed.)
The two main issues I foresee you possibly running into is:
A) Primarily not being able to import your image to the Excel document you are creating through 'Excel Buffer' (Contains no function allowing Image importation)
The time in which it takes for Excel Buffer to construct your Excel document (since it makes references Cell-By-Cell and slows the process down greatly)
An other approach is; Use a template excel sheet in which the logo is already inserted. Open this, put your data in and save as ...
I got the blob stored in a temporary folder. However, I'm missing one more step. This might sound like a really dumb question... how do you add the shape in Excel via code in Navision? :oops:
Specifically,
Santosh
Where Stones can be transformed to Gold
http://www.BiloBeauty.com
http://www.autismspeaks.org
xlSheet ist the Automation of Excel Worksheet.
for an better help, let show us your code.
I can only assume he has attempted to move on to using the automation since 'Excel Buffer' does not give you this freedom.
The Function CreateSheet() in "Excel Buffer" table generates the Shape.
So where is the Problem ? New Function in this Table Like
Here we store in a global variable the Path
in function CreateSheet() we check the Value of the variable FilePathAndName and check if folder and file exist. if both is true, we import the Picture in our shape.
regards
I'd like to be able to export a blob to excel using the excel buffer table.
I read the solution proposed by garak but I think I'm missing something.
Let's assume that I want to export X items from the inventory to excel.
Each item has a custom field to store the blob for the image.
I would like to have the image in row 1, column 1, and then the no. of the item just under it, row 2, column 1.
I then skip 2 lines, and I do the same with item #2, and so on, until I reached item #X.
The way I understand the excel buffer table is that you enter a record for each value you want to send to excel, and at the end, you call the createsheet function to create the worksheet. Creating a new function to set the path of the image isn't working as I have multiple blob to export to excel.
Is there another way to do it?