The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 4
Joined: Jan 11, 2013
Company: Brighteye AB

Hi, want to load picture or logo from file into template headers but can't find how to. The intension is to be able for customers to choose what logo they want to use for printouts and reports, whitout using PictureLib. Regards
Keijo

 
#2
People who like this: 0 Yes / 0 No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

If it is logo pic of company.
1. Create Constant (type - ValueStorage).
2. Fr om some wh ere set to this constant picture in valuestorage:

Code
SelectedPic = New Picture(<FileName>, <Transparent>);
Constant  = New ValueStorage(SelectedPic, New Deflation);

3. In spreadsheet docum. create a field picture.
4. In code for showing:
Code
SpArea = Template.GetArea("BaşYazısı");
   
// logo 
SpArea.Drawings.Logo.Picture = Constants.Constant.Get();

 
#3
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

You can also insert pictures dynamically, but predefined items are the better way.

Code
   Picture = Area.Drawings.Add(SpreadsheetDocumentDrawingType.Picture);
   Picture.Top = 0;
   Picture.Height = 9;
   Picture.Width = 9;
   Picture.Left = 30;
   Picture.Picture = New Picture(FileName);
   Picture.PictureSize = PictureSize.Proportionally;

 
#4
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Hello;

I have binary data stored in ValueStorage field.

Can you tell me please how can I get that data and display as picture in the Product Form?

I'm doing it like:

Code
   ThisObject = Object.Ref.GetObject();
   ThisForm.UnlockFormDataForEdit();

 either this
Code
   ThisForm.Items.PhotoPlaceholder = New Picture(ThisObject.Zdjecie.Get());

 or that
Code
   Items.PhotoPlaceholder.Picture = New Picture(ThisObject.Zdjecie.Get());

 but either there's "wrong type of data" or "item is not open for write". I'm clueless.

 
#5
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Joanna!
The picture form item is a string with an URL, so you need to put your picture to the temp storage and specify an address of it as the form item value.

 
#6
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Thank you! I'll try to do it and get back with the result :)

 
#7
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

I'm clueless.

The farthest I could get is to display blank picture.

I know that ValueStorage contains appropriate data since my buttons "save file" and "view file" work properly.

When I tried this:

Code
ObjectValue = FormDataToValue(Object, Type("CatalogObject.CatalogProducts"));
Path = PutToTempStorage(ObjectValue.Zdjecie.Get());
ThisForm.Items.PhotoPlaceholder.Picture = New Picture(Path);


I got:
Code
Catalogue path doesn't exist "e1cib\tempstorage\f22b2601-1839-4ba2-8fc8-c06173efeee5"


Also in This code:

       
Code
ThisObject = Object.Ref.GetObject();
   SelectedPic = New Picture(ThisObject.Zdjecie.Get());
   
   ObjectValue = FormDataToValue(Object, Type("CatalogObject.CatalogProducts"));
        Path = PutToTempStorage(ObjectValue.Zdjecie.Get());

   ImageExt = Items.Add("ImageNew", Type("FormDecoration"), Items.Group8); 
   ImageExt.Type = FormDecorationType.Picture;


Both This:
Code
ImageExt = SelectedPic;   


And This:
Code
ImageExt = Path;


Gives me blank picture.

And This:
Code
ImageExt = New Picture(Path);


Returns "Catalog not found error".



I'm so tired and frustrated... I'm using 1C 8.2.14.528

 
#8
People who like this: 1 Yes / 0 No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

I cant test on your version of 1C, I use 8.2.17.169
For me work next:

I add attribute "Zdjecie" with type "ValueStorage"
Then add on form item element Field "PictureElement" with type "Image field" and attribute "PictureAddress" with type String (which contain url to picture)

[img]pic_99984[/img]

And connect Data path of Field to attribute

Code
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   // Here I initialize attribute of form
   PictureAddress = GetURL(Object.Ref, "Zdjecie");
EndProcedure

 
#9
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Thank you very much ivan avdonin, it works! :D

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)