Vertical text alignment in Crystal Reports?

前端 未结 5 1386
无人及你
无人及你 2021-01-17 07:44

In the Crystal Reports editor that comes with Visual Studio (2008) is it possible to align text to the center of a text box rather than to the top?

I can\'t find the

5条回答
  •  离开以前
    2021-01-17 07:51

    Vertical alignment with programming line breaks. Algorithm for the one cell:

    1. Count the number of characters in data (iTextLen).
    2. Find the number of text lines in cell (iLineNum). Calculated empirically.
    3. Find the row length in characters (iLineLen). Calculated empirically.
    4. Calculate count the number of halfbreaks by formula (iLineNum — 1) — (iTextLen / iLineLen).

      @formula in crystal syntax:

      Local NumberVar iLineNum:= 5;
      Local NumberVar iLineLen:= 30;
      Local NumberVar iTextLen:= Length({DataSource});
      
      Local StringVar sRet:= '';
      Local NumberVar i;
      Local NumberVar iLinesNum:= Truncate(iLineNum - 1) - Truncate(iTextLen / iLineLen); 
      For i:= 1 to iLinesNum Do ( sRet:= sRet + chr(13) );
      
      sRet
      
    5. Add formula to the top and bottom of data. Text objects will look like this:
      {@formula}{DataSource}{@formula}

      Font size of @formula must be halved of font size {DataSource}. For example, if the font size of {DataSource} equal to 20, the @formula should be equal to 10:

    Algorithm works better with monospaced typeface, but with proportional typeface works in most cases.

    Algorithm for multiple cells is differ only that iLineNum will be the maximum number of characters in data of all cells.

提交回复
热议问题