Arrange text around images

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Arrange text around images

Post by Fabio Pagano »

Hi,
I need to set image in order to arrange text around images (see. attacched "with image in field"). When field image is null text will be formatting as the attached file "without image in field".

Thanks for reply
Attachments
foto2_stimul.png
foto2_stimul.png (59.49 KiB) Viewed 4251 times
without image in field.png
without image in field.png (39.82 KiB) Viewed 4251 times
with image in field.png
with image in field.png (125.35 KiB) Viewed 4251 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Arrange text around images

Post by Alex K. »

Hello,

As a way, you can use an additional code in the BeforePrint event, in which check Image and if it is empty set the DockStype=Top or increase Width for Text components.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Arrange text around images

Post by Fabio Pagano »

hello,
could you show me an exemple?
thank you
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Arrange text around images

Post by Alex K. »

Hello,

You can use the following code in the BeforePrint event of the DataBand5:

Code: Select all

if (DataSourceName.ColumnImageName == null)
{
	Image1.Enabled = false;
	Text1.DockStyle = Stimulsoft.Report.Components.StiDockStyle.Top;
	Text2.DockStyle = Stimulsoft.Report.Components.StiDockStyle.Top;
}
Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Arrange text around images

Post by Fabio Pagano »

Thank you for reply.

I've achieved to set the text close the image, and to extend text horizontally when image is missing.

I used this code in the BeforePrint event of the DataBand5:

if (DescrizioneLavoroDettagliata.Lavoro__Immagine == DBNull.Value)
{
Image12.Enabled = false;
Text183.Width = 12;
Text184.Width = 17;
}
else
{
Image12.Enabled = true;
Text184.Width = 12;
}

In this way when image12 il not null the text184 Width is just defined.
The text isn't around image as you can see in the attacched file (text close image)

Anyway i'd like to have text surrounding image (see file text surrounding image)

thanks in advance
Attachments
text close image (2).png
text close image (2).png (112.81 KiB) Viewed 4162 times
text surrounding image.png
text surrounding image.png (128.61 KiB) Viewed 4162 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Arrange text around images

Post by Edward »

Hi Fabio,

That task is definitely much more complicated, and we either need to render in 3 text boxes, either change the text rendering in the one textbox so the image is displayed above the text, which would cause the problems with the export of that report. I think that Alex's solution and yours that is kindly explained here is the best approach we could think of, despite the fact that the text is not floating around the image as you needed it to. Sorry about that.

Thank you,
Edward
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Arrange text around images

Post by Fabio Pagano »

No problem. Thank you very much.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Arrange text around images

Post by HighAley »

Hello, Fabio.

You could also try to use the RenderTo property.
This will allow you to render the text in several components.

Thank you.
Attachments
Report.mrt
(239.05 KiB) Downloaded 184 times
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Arrange text around images

Post by Fabio Pagano »

Hello, HighAley,
thanks for your great idea. Joining with mine I managed to reach my goal.

At the end to arrange text around image (to riproduce Office Word image property)

I Use 3 textbox (text1, text2, text3) and the Renderto property for text1 to text2 and text2 to text3 (file1 attacched)

To avoid leaving the empty image space if it is not inserted, in BeforePrint event of DATABAND I set this code:

if (

'condition'

)

{
Image1.Enabled = false;
Text2.Width = 19;

}
else
{
Image1.Enabled = true;
Text2.Width = 15;

}




Good job
Attachments
renderto2.png
renderto2.png (75.95 KiB) Viewed 3848 times
file1
file1
renderto1.png (71.8 KiB) Viewed 3848 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Arrange text around images

Post by Lech Kulikowski »

Hello,

Thank you for the provided solution.
Post Reply