Background Color:
Background Pattern:


Please Log In

We want you to contribute! 

This forum is a moderated environment. 
We try to keep it neat and tidy. In order to access the forum content we would like you to either or register.

HomeHomeScryberScryberIssues and Defe...Issues and Defe...Binding to the Width AttributeBinding to the Width Attribute
New Post
1/6/2015 1:44 PM



Is it possible to bind to the width attribute using XPath? I have got it to work with the Item binding by adding an instance of PDFUnit to my object with the required value parameter. How would i go about doing this with XPATH binding. Unfortunately i need to use XPath binding as item binding does not support enumerating a list. 

Hopefully this is supported but if not, please can i suggest that when you try to bind, if the value passes as a numeric then you create a PDFUnit object with the value and no units. 

Many thanks, Mingo


New Post
1/6/2015 2:36 PM

Hi again Mingo

It is possible to bind PDFUnit values either with or without the unit extension to widths, 

(And just for info - you can with margins, colours, dashes etc. The required types all have a static Parse method and are decorated with the PDFParsableValue attribute so the reflector knows how to deal with them.)

Example I have used...




<?xml version="1.0" encoding="utf-8" ?>


  <Item border1="#FF0000" width1="54mm" text1="first row" border2="#FFFF00" width2="100mm" text2="wider cell" />

  <Item border1="#FF0000" width1="54mm" text1="second row" border2="#FF00FF" width2="120mm" text2="wider cell" />





<?xml version="1.0" encoding="utf-8" ?>

<pdf:Document xmlns:pdf="Scryber.Components, Scryber.Components, Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe"

              xmlns:style="Scryber.Styles, Scryber.Styles, Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe"

              xmlns:data="Scryber.Data, Scryber.Components, Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe"











          <data:ForEach datasource-id="WidthsData" select="Items/Item" >



                <pdf:Cell style:border-color="{xpath:@border1}" style:width="{xpath:@width1}">

                  <pdf:Label text="{xpath:@text1}" />


                <pdf:Cell style:border-color="{xpath:@border2}" style:width="{xpath:@width2}">

                  <pdf:Label text="{xpath:@text2}" />









    <data:XMLDataSource source-path="BindingWidthsData.xml" id="WidthsData" />



And you can apply transformations with parameters to your data if it makes it more effective. Also the mixing of item binding can be done without impact to the current xpath data context.

New Post
1/6/2015 2:57 PM

Superb, thanks.

HomeHomeScryberScryberIssues and Defe...Issues and Defe...Binding to the Width AttributeBinding to the Width Attribute