Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



Dealing with Blank Fields in Word Documents

Integra for Notes can be used to generate Microsoft Word documents picking values both from fields and computed fields and including these among normal text, tables and graphics in Word. If when exporting data, one or more of the fields being exported to Word is empty, then a blank space is normally left where the field is defined.

There two different scenarios which have to be tackled differently. In the first scenario a field or a series of fields is located in one paragraph, for instance the recipient's full name of an address label, which usually consist of the fields
<Title> <Name> <Surname>

The second scenario a field or series of fields is located in a sequence of paragraphs, for instance the address part of the same address label, which usually consist of the fields
          <Address1>
          <Address2>
          <City><POC>
          <Country>


Scenario 1
    For the first scenario there are three different options which allow mitigation of this situation:

    Utilise Integra naming option for Word fields
      Integra allows the field created in the Word document to contain a + sign as a part of the definition and when a field with a + sign is found, if the field is empty, no blank space will substitute the field.

      To utilise this facility, create the field in the Integra profile in the standard way and then include the field in the Word document as you would normally due. This will result in a field appearing looking like this:
      «Surname»

      Manually intervene and change the field name to appear as follows:
      «Surname+»

      To change the field name do not simply type into the grey field area, but right click on the field and select Edit Field option from the right mouse pop-up menu. In the upcoming dialog change the content of the Name field.
    Utilise Word mergefield options (available only in MS Office XP)
      Using the + symbol as explained above is not a MS Word feature, but an Integra feature. MS Office XP offers a new feature that can be used instead of the Integra feature. In the same Word dialog discussed above (Edit Field) Word XP offers an option Text to be inserted after or alternatively Text to be inserted before in which one can enter any text (in this context it would be a space). This text will only be inserted after or before provided the field has a content in the first place.
    Utilise computed fields
      Another option is to utilise a computed field, the value of which will be based on the contents of the Notes field. When creating the Integra Profile, rather than calling a field called Surname, create a Computed Field within the Selected Field List of the Fields Tab of the Integra Profile called for instance Surname_Comp, the value of which would be a formula such as:
      @If( ! @IsAvailable(Surname) ; "" ; @Trim(Surname) = "" ; "" ; @Trim(Surname) + " " )
      This formula will add a space to the Surname field provided it exist and has a content (is not blank)
Scenario 2
    For the second scenario there is only one option, using computed fields:
    The problem with this scenario is that using a similar formula like the one discussed above will not do the trick. This as it will not avoid the blank paragraph that for obvious reasons will not be automatically removed. To solve the problem we need to combine the fields into one computed field, which formula will add the content of the required fields to a multi-value content that when exported is normalised using the multi-value character (separator) defined in the Integra profile. Which in this context should be CR for a carriage return.

    So in the above pictured scenario instead of having 5 fields (<Address1>,<Address2>,<City>,<POC>,<Country>) we create one computed field having a formula such as:
          cityPOC := @If( POC = "" | City = "" ; City + POC ; City + ", " + POC );
          fullAddress := Address1:Address2:cityPOC:Country;
          @Explode( @Implode( fullAddress ; @NewLine) ; @NewLine ; 0 );

    The disadvantage of this method is that the entire address will appear in the Word document in the same font formatting. If it is for instance desired to have the Country field in bold and underlined it should be kept out of the above formula and exported as separate field having the desired formatting in its own paragraph.

.




FAQ# 0015
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024