[Qgis-user] Multiple lines label in QGIS 2.0 print composer using wrap on character?
Alexandre Neto
senhor.neto at gmail.com
Wed Oct 23 03:31:16 PDT 2013
Thanks you for your answers,
In fact, the text for my label is generated in a postgis query that group
several features to be shown in the same page. My aim was too
use string_agg() with '/n' delimiter, to group several text fields and show
them in different lines in a text label in QGIS print composer.
Therefore my resulting field values was something like:
'CR02 - Cascais\nCR09 - Fontainhas'.
But when rendered by atlas, this does not create the breaklines.
The solution was to use '</br>' as delimiter in string_agg(), and render
the label as HTML. Yet, I add to recreate the font style and position with
HTML. Something like this:
<span style="font-family:Verdana; font-size: 16 pt; font-weight: bold;
position:absolute; top:20%;">
[%descricao%]
</span>
Best regards,
Alexandre
On Tue, Oct 22, 2013 at 10:52 PM, Carlos López PSIG <carlos.lopez at psig.es>wrote:
> Hello Alexandre and everyone,
> You can use "Expresion based label" in label properties...
> For instance:
>
> CASE
> WHEN "CRLFPOS1" = 0 THEN "TEXT_TOP"
> WHEN "CRLFPOS1" > 0 AND "CRLFPOS2" = 0
> THEN
> substr("TEXT_TOP",1,"CRLFPOS1"-1)||'\n'||substr("TEXT_TOP","CRLFPOS1"+1,length("TEXT_TOP")-"CRLFPOS1"+1)
> WHEN "CRLFPOS1" > 0 AND "CRLFPOS2" > 0
> THEN
> substr("TEXT_TOP",1,"CRLFPOS1"-1)||'\n'||substr("TEXT_TOP","CRLFPOS1"+1,"CRLFPOS2"-"CRLFPOS1")||'\n'||substr("TEXT_TOP","CRLFPOS2"+1,length("TEXT_TOP")-"CRLFPOS2"+1)
> END
>
> Where "CRLFPOS1" is a numeric field with the position the first breakline
> And "CRLFPOS2" is a numeric field with the position the second breakline
>
> "TEXT_TOP" is a string field that contain annotations.
>
> I hope that my mail help you ...
>
> Regards,
>
> *
> *
> *
> *
> *
> *
> *Carlos López Quintanilla*
>
>
> www.psig.es
> carlos.lopez at psig.es
> +34 699.680.261
>
>
>
>
> 2013/10/22 Lene Fischer <lfi at life.ku.dk>
>
>> Hi
>> The trick is:
>> expression/field || '\n' || expression/field
>>
>> || is the seperator between fields.
>>
>> Regards
>> Lene Fischer
>> ------------------------------
>> *Fra:* qgis-user-bounces at lists.osgeo.org [
>> qgis-user-bounces at lists.osgeo.org] på vegne af Alexandre Neto [
>> senhor.neto at gmail.com]
>> *Sendt:* 22. oktober 2013 11:09
>> *Til:* QGIS User
>> *Emne:* [Qgis-user] Multiple lines label in QGIS 2.0 print composer
>> using wrap on character?
>>
>> Hello all,
>>
>> Is there a way to create multiple lines label using a wrap on character
>> in QGIS 2.0 print composer? Or this must be done with html rendering?
>>
>> I'm using atlas generation and the label source is attribute from my
>> coverage layer.
>>
>> Thanks,
>>
>> Alexandre Neto
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20131023/f52842d9/attachment.html>
More information about the Qgis-user
mailing list