Text alignment "Justify" is not aligned in Crystal Viewer.

Hi,
I am having a text field in report like paragraph format in Detail section and I have setting the text alignment as u201CJustifyu201D. If I launch the report through dhtml viewer the text is not aligned in justify format, it is getting aligned as left alignment, but it is working properly while exporting to PDF and Design Preview panel.
This problem is occurs in Crystal Report XI Release 2 and Crystal Report 2008 also.
This has been already posted and the link is Text Alignment - Justification Problem
Please help me to overcome this issue.
Thanks in Advance.

With CR 2008, make sure you are on SP4:
SP4
https://smpdl.sap-ag.de/~sapidp/012002523100008782452011E/cr2008sp4.exe
SP4 MSI
https://smpdl.sap-ag.de/~sapidp/012002523100008782532011E/cr2008sp4_redist.zip
SP4 MSM
https://smpdl.sap-ag.de/~sapidp/012002523100008782522011E/cr2008sp4_mm.zip
If that does not help, please provide a link to screen shots of the issue.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Similar Messages

  • Cascading Dynamic Parameters Do Not Work In Crystal Viewer 2008?

    I have generated a report with Crystal Reports 2008 that uses a dynamic cascading parameter. I work in waste management and the report I create in Crystal is used as a "template" with the tonnages collected from all of our customers. Our less technically minded employees can then open this report with Crystal Reports Viewer 2008, use the drop down menus to select only the customer they need a report for and then export this to PDF for delivery.
    The report as designed works perfectly in Crystal Reports, but the parameter does not work in Crystal Viewer.
    Some of our customers have more than one physical location that we service. The cascading dynamic parameter in my report allows you to select the customer name, and then it only shows the locations linked to that customer, so the end user can select only the relevant location(s) for the report. The cascading parameter is dynamic and allows multiple selections, and is linked to a Saved Data formula. The report is saved with the data.
    When the report is opened in Viewer, one of two things happens. If the report is saved in Crystal Reports and a specific customer/location is selected, then ONLY those selected customer/locations are available in the Viewer. If ALL the customers/locations are selected in Crystal Reports and saved, then in the Viewer they are all available, but selecting one customer does NOT narrow down the locations (i.e. it does not "cascade") and instead ALL of the locations are available even if they do not apply to the customer.
    If I use a single dynamic parameter and select ALL of the customers (for example), then when this is opened in Crystal Viewer all of the customers are available from the parameters drop down and the report works fine. As soon as this is tried with a cascading parameter however, Crystal Viewer falls down.
    Does anyone know of a workaround to this or if there is something I am doing wrong?

    I am using the free Crystal Report 2008 Viewer along with designing reports with Crytal Reports ver 12.3. With a test file from SAP called "Interactive Parameters", the parameter feature works to refresh the report. The parameters that are supplied in the sample report work with Viewer. They show up under the parameter list in the parameter side panel in Viewer and are available to make record selections. When I add a parameter to the sample report in Crystal 2008 and then view the report in Viewer, my parameters are unavalable for record selection while the original parameters remain available. Futher, my parameters are displayed under a section called "Current Data Set" in the Parameter side panel, while the selectable parameters are displayed under the "Parameter" section in the parameter side panel. There must be a setting that is treating the parameters I create differently form the parameters created in the original sample report. Any help would be appreciated.

  • ActiveX print window is not opening from crystal viewer

    Hi ,
    I'm facing problem on Printing from Crystal viewer .
    I have launched the crystal report from an ASPX application.  For the print icon , I have added code for opening the ActiveX print window instead of usual crystal print window.
    Issue is  , print window is not opening in the client machines whereas window is opening properly in the server machine where the crystal report is installed.
    We have implemented RDC type of reporting and not the RAS .
    Product Name  : Crystal Report X1 Release 2 
    Version : 11.5.3700.0
    Evaluation Copy
    Thanks !
    Regards
    Varun

    See if the blog [Problems installing Crystal Reports 2008 Print Control(ActiveX)|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417500)ID1617741650DB11112347389125823727End?blog=/pub/wlg/14395] helps.
    The blog was written for CR 2008, but all applies to CR XI r2 with the following differences;
    crystalreportviewers12 = crystalreportviewers115
    "Crystal Reports 2008 .NT SDK Developer Guide" = [XIR2 SDK Documentation|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm]
    Ludek
    Edited by: Ludek Uher on Oct 22, 2009 6:50 AM

  • Illustrator CS 6 - tabs not aligning

    anyone else having an issue with tabbed text in a paragraph not aligning?

    I have the same problem!
    Illustrator CS6 ran fine before I installed OS X 10.10 Yosemite on my MacBook Pro.  But it never ran once afterwards.  When I launch AI CS6, it says it needs me to install the legacy Java SE 6 runtime.  Did anyone else encounter this?  I don't want to install the older version of java without knowing if it'll fix the problem, or what the impact will be to other programs which all seem to run fine after my upgrade to Yosemite.  Any guidance out there for us?
    Thanks a ton!
    -Eric

  • Crystal Viewer error "This field name is not known"

    I have MAS500 with crystal 10 that runs a report from a view in a SQL data base and it ran fine when only MAS500 and ABRA were installed on the terminal server. Then we installed a new product CribMaster that also uses Crystal 10.  After CribMaster was installed we got the error "This field name is not known" from Crystal viewer.  The report has a selection parametar .  I feel that there is a dll file that got over written, but do not know which one.  I can run the report from Crystal OK, but not from within the application.

    Since you can run the report from Crystal OK, but not from within the application, I'd recommend trying to figure out the dlls loading, or not in the app. Use a utility such as [Modules|https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip] to determine the differences. Modules will compare the log results for you (Module menu, choose "Differences").
    You may also want to consider contacting the app creators to see if they can help...
    Ludek

  • Can you view Subreports in Crystal Viewer 2008

    I've created a report in Crystal Reports XI that also included two subreports.
    When I open it up in Crystal Viewer 2008 I'm not sure how to view the subreports.
    Any ideas?
    Thanks.

    In Crystal Viewer you cannot refresh the report. You can refresh only when you are opening the report from server. So if your report consist of any on demand subreports it refreshes only when you click on the link. So I thikn on-demand subreport do not work in crystal viewer.
    Regards,
    Raghavendra

  • Hyphenation & text-align:justify in PDF's with CFDOCUMENT

    Hello everybody!
    We are using CF8.1 and are having problems of generating well designed PDF outputs with CFDOCUMENT. We would like to print out reports, which are hyphenated and have the text aligned. Example:
    This works fine:
    <html lang="en">
    <STYLE>p { width:260px;background-color:blue;-moz-hyphens: auto; -o-hyphens: auto; -webkit-hyphens: auto; -ms-hyphens: auto;  -hyphens: auto;text-align:justify}</STYLE>
    <P>Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer</P>
    </html>
    This won't:
    <CFDOCUMENT FORMAT="PDF">
    <html lang="en">
          <STYLE>p { width:260px;background-color:blue;-moz-hyphens: auto; -o-hyphens: auto; -webkit-hyphens: auto; -ms-hyphens: auto;  -hyphens: auto;text-align:justify}</STYLE>
          <P>Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer Haematodynamometer</P>
    </html>
    </CFDOCUMENT>
    Do you have any solutions on this topics? Are do I have to wait until CF11.
    Thanks in advance
    Matthias

    4tun8mom wrote:
    Now, the problem is that, while the client likes this, they don't like that the headers and footers are grayed out and the colors are not as vibrant in Word as the program part I created and saved as a PDF.
    They're being a bit impractical in their complaints, in fact they remind me of my Dad!  The final product is still fine.
    4tun8mom wrote:
    They also don't like that if we keep this as a Word document, all the text is editable.
    That's fair enough, the solution would be to make the text in the header and footer an image instead.
    4tun8mom wrote:
    So my question is, can I create a PDF that has the same features with the expandable text control boxes.  If I can, would you recommend InDesign to do this?
    No you can't.  I'm pretty sure you can't create a PDF with expandable boxes and I'm very sure that you can't create a PDF that will add pages with headers and footrs.  However you can create a PDF with basic fillable text boxes, they're called forms and you need Acrobat as well to do it, google it and you'll find plenty of info.

  • How to align the text in justify format with SQL Server Reporting Services?

            How to align the text in justify format In SQL server Reporting Services? Is there any code to do so?

    Hi,
    I'm afraid that if you want to have this kind of functionality, you will need to write a custom control. Here is an example: http://msdn2.microsoft.com/en-us/library/ms345265.aspx. The issue with custom controls is that it needs to be known by all the reportservers that will render your report.
    Greetz,
    Geert
    Geert Verhoeven
    Consultant @ Ausy Belgium
    My Personal Blog

  • Text not aligning right - too much space on top or bottom in tables

    Hi,
    I am in the process of learning DW myself and building my own website, but have run into problems putting my cv into a nice format.
    Here is the link:
    http://www.junjundesigns.com/cv.html
    First of all, in dw, it looks much different than it does when it loads in my firefox.
    The problem that I can't solve is how the text on the left in the body does not align to the top of the box, to equal height of the text in the right is.
    For example, I want "20047 Jul-Present" to begin at the same level/height as "Etam Clothing Company Ltd. - Designer Manager", and subsequently I want the next item "2007 Apr-Jul" to align to the top of "The Collection..." and so on.
    I checked the codes and I don't find any extra /p or br/ breaks, and tried putting more in and taking some out with the same results or just not what I want.
    Please help. Thanks!

    I have two suggestions:
    1. Vertically align your table cells to Top:
              <td width="172" valign="top" bgcolor="#0099FF"><p>2007 Jul-Present <br />Shanghai, China</p></td>
              <td width="684" valign="top" bgcolor="#0099FF"><p align="left"><strong>Etam Clothing Company..............
    2. Learn to lay your pages out with CSS instead of tables. You will have much more control with positioning elements on a page.

  • Content Alignment = Justify In text Box

    Dear Friend,
    i have text Area Item for description .Here i want content alignment justify in that Text Area.
    How can i alighnment in Text Box.
    Thanks
    Edited by: Vedant on Sep 16, 2011 4:32 AM

    Hello,
    if by text box you mean a standard textarea item then i'm afraid you can't do that.
    It might be possibel if you use a rich text editor item.
    Regards,
    Dirk

  • Align JUSTIFIED, firstLineIdent, lineSpacing solution

    Align Justified, First line ident, line spacing features don't work correct.
    So i can suggest solution for these things.
    I implemented my ParagraphView class for this purpose.
    Hope it helps for somebody.
    best regards
    Stas
    This is the source code of example.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.util.*;
    * Represents extension for Paragraph view.
    * @author     Stanislav Lapitsky
    class Main {
    JEditorPane pane;
    int ALIGNMENT=StyleConstants.ALIGN_JUSTIFIED;
    float LINE_SPACING=2;
    float FIRST_LINE_IDENT=50;
    public Main() {
    JFrame mainFrame=new JFrame("Advanced paragraph features support...");
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pane=new JEditorPane();
    pane.setEditorKit(new StyledEditorKit_());
    JScrollPane sp=new JScrollPane(pane);
    mainFrame.getContentPane().setLayout(new BorderLayout());
    mainFrame.getContentPane().add(sp,BorderLayout.CENTER);
    StyledDocument doc=(StyledDocument)pane.getDocument();
    try {
    doc.insertString(0,"Advanced paragraph view implements following features: First line ident support, line spacing support, alignment justified support. Implemented by Stanislav Lapitsky. ",null);
    catch (Exception ex) {
    MutableAttributeSet attr=new SimpleAttributeSet();
    StyleConstants.setFirstLineIndent(attr,FIRST_LINE_IDENT);
    StyleConstants.setLineSpacing(attr,LINE_SPACING);
    StyleConstants.setAlignment(attr,ALIGNMENT);
    doc.setParagraphAttributes(0,doc.getLength()-1,attr,false);
    mainFrame.setBounds(100,100,330,200);
    mainFrame.show();
    public static void main(String[] args) {
    new Main();
    class StyledEditorKit_ extends StyledEditorKit {
    public ViewFactory getViewFactory() {
    return new StyledViewFactory_();
    class StyledViewFactory_ implements ViewFactory {
    public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
    if (kind.equals(AbstractDocument.ContentElementName)) {
    return new LabelView(elem);
    } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
    // return new ParagraphView(elem);
    return new AdvancedParagraphView(elem);
    } else if (kind.equals(AbstractDocument.SectionElementName)) {
    return new BoxView(elem, View.Y_AXIS);
    } else if (kind.equals(StyleConstants.ComponentElementName)) {
    return new ComponentView(elem);
    } else if (kind.equals(StyleConstants.IconElementName)) {
    return new IconView(elem);
    // default to text display
    return new LabelView(elem);
    * Represents extension for Paragraph view.
    * @author     Stanislav Lapitsky
    class AdvancedParagraphView extends ParagraphView {
    public AdvancedParagraphView(Element elem) {
    super(elem);
    strategy=new AdvancedFlowStrategy();
    protected View createRow() {
    Element elem = getElement();
    return new AdvancedRow(elem);
    protected static int getSpaceCount(String content) {
    int result=0;
    int index=content.indexOf(' ');
    while (index>=0) {
    result++;
    index=content.indexOf(' ',index+1);
    return result;
    protected static int[] getSpaceIndexes(String content,int shift) {
    int cnt=getSpaceCount(content);
    int[] result=new int[cnt];
    int counter=0;
    int index=content.indexOf(' ');
    while (index>=0) {
    result[counter]=index+shift;
    counter++;
    index=content.indexOf(' ',index+1);
    return result;
    public static class AdvancedFlowStrategy extends FlowStrategy {
    public void layout(FlowView fv) {
    super.layout(fv);
    AttributeSet attr=fv.getElement().getAttributes();
    float lineSpacing=StyleConstants.getLineSpacing(attr);
    boolean justifiedAlignment=(StyleConstants.getAlignment(attr)==StyleConstants.ALIGN_JUSTIFIED);
    if (!(justifiedAlignment || (lineSpacing > 1)) ){
    return;
    int cnt=fv.getViewCount();
    for (int i=0; i<cnt-1; i++) {
    AdvancedRow row=(AdvancedRow)fv.getView(i);
    if(lineSpacing > 1) {
    float height = row.getMinimumSpan(View.Y_AXIS);
    float addition = (height * lineSpacing) - height;
    if(addition > 0) {
    row.setInsets(row.getTopInset(), row.getLeftInset(),
    (short) addition, row.getRightInset());
    if (justifiedAlignment) {
    restructureRow(row,i);
    row.setRowNumber(i+1);
    protected void restructureRow(View row,int rowNum) {
    int rowStartOffset=row.getStartOffset();
    int rowEndOffset=row.getEndOffset();
    String rowContent="";
    try {
    rowContent=row.getDocument().getText(rowStartOffset,rowEndOffset-rowStartOffset);
    if (rowNum==0) {
    int index=0;
    while (rowContent.charAt(0)==' ') {
    rowContent=rowContent.substring(1);
    if (rowContent.length()==0)
    break;
    catch (Exception e) {
    e.printStackTrace();
    int rowSpaceCount=getSpaceCount(rowContent);
    if (rowSpaceCount<1)
    return;
    int[] rowSpaceIndexes=getSpaceIndexes(rowContent,row.getStartOffset());
    int currentSpaceIndex=0;
    for (int i=0; i<row.getViewCount(); i++) {
    View child=row.getView(i);
    if ((child.getStartOffset()<rowSpaceIndexes[currentSpaceIndex]) &&
    (child.getEndOffset()>rowSpaceIndexes[currentSpaceIndex])) {
    //split view
    View first=child.createFragment(child.getStartOffset(),rowSpaceIndexes[currentSpaceIndex]);
    View second=child.createFragment(rowSpaceIndexes[currentSpaceIndex],child.getEndOffset());
    View[] repl=new View[2];
    repl[0]=first;
    repl[1]=second;
    row.replace(i,1,repl);
    currentSpaceIndex++;
    if (currentSpaceIndex>=rowSpaceIndexes.length)
    break;
    int childCnt=row.getViewCount();
    class AdvancedRow extends BoxView {
    private int rowNumber=0;
    AdvancedRow(Element elem) {
    super(elem, View.X_AXIS);
    protected void loadChildren(ViewFactory f) {
    public AttributeSet getAttributes() {
    View p = getParent();
    return (p != null) ? p.getAttributes() : null;
    public float getAlignment(int axis) {
    if (axis == View.X_AXIS) {
    AttributeSet attr=getAttributes();
    int justification=StyleConstants.getAlignment(attr);
    switch (justification) {
    case StyleConstants.ALIGN_LEFT:
    case StyleConstants.ALIGN_JUSTIFIED:
    return 0;
    case StyleConstants.ALIGN_RIGHT:
    return 1;
    case StyleConstants.ALIGN_CENTER:
    return 0.5f;
    return super.getAlignment(axis);
    public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException {
    Rectangle r = a.getBounds();
    View v = getViewAtPosition(pos, r);
    if ((v != null) && (!v.getElement().isLeaf())) {
    // Don't adjust the height if the view represents a branch.
    return super.modelToView(pos, a, b);
    r = a.getBounds();
    int height = r.height;
    int y = r.y;
    Shape loc = super.modelToView(pos, a, b);
    r = loc.getBounds();
    r.height = height;
    r.y = y;
    return r;
    public int getStartOffset() {
    int offs = Integer.MAX_VALUE;
    int n = getViewCount();
    for (int i = 0; i < n; i++) {
    View v = getView(i);
    offs = Math.min(offs, v.getStartOffset());
    return offs;
    public int getEndOffset() {
    int offs = 0;
    int n = getViewCount();
    for (int i = 0; i < n; i++) {
    View v = getView(i);
    offs = Math.max(offs, v.getEndOffset());
    return offs;
    protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
    baselineLayout(targetSpan, axis, offsets, spans);
    protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
    return baselineRequirements(axis, r);
    protected int getViewIndexAtPosition(int pos) {
    // This is expensive, but are views are not necessarily layed
    // out in model order.
    if(pos < getStartOffset() || pos >= getEndOffset())
    return -1;
    for(int counter = getViewCount() - 1; counter >= 0; counter--) {
    View v = getView(counter);
    if(pos >= v.getStartOffset() &&
    pos < v.getEndOffset()) {
    return counter;
    return -1;
    public short getTopInset() {
    return super.getTopInset();
    public short getLeftInset() {
    return super.getLeftInset();
    public short getRightInset() {
    return super.getRightInset();
    public void setInsets(short topInset,short leftInset, short bottomInset, short rightInset) {
    super.setInsets(topInset,leftInset,bottomInset,rightInset);
    protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
    super.layoutMajorAxis(targetSpan,axis,offsets,spans);
    AttributeSet attr=getAttributes();
    if ((StyleConstants.getAlignment(attr)!=StyleConstants.ALIGN_JUSTIFIED) && (axis!=View.X_AXIS)){
    return;
    int cnt=offsets.length;
    int span=0;
    for (int i=0; i<cnt; i++) {
    span+=spans;
    if (getRowNumber()==0)
    return;
    int startOffset=getStartOffset();
    int len=getEndOffset()-startOffset;
    String context="";
    try {
    context=getElement().getDocument().getText(startOffset,len);
    catch (Exception e) {
    e.printStackTrace();
    int spaceCount=getSpaceCount(context)-1;
    int pixelsToAdd=targetSpan-span;
    if (this.getRowNumber()==1) {
    int firstLineIndent=(int)StyleConstants.getFirstLineIndent(getAttributes());
    pixelsToAdd-=firstLineIndent;
    int[] spaces=getSpaces(pixelsToAdd,spaceCount);
    int j=0;
    int shift=0;
    for (int i=1; i<cnt; i++) {
    LabelView v=(LabelView)getView(i);
    offsets[i]+=shift;
    if ((isContainSpace(v)) && (i!=cnt-1)) {
    offsets[i]+=spaces[j];
    spans[i-1]+=spaces[j];
    shift+=spaces[j];
    j++;
    protected int[] getSpaces(int space,int cnt) {
    int[] result=new int[cnt];
    if (cnt==0)
    return result;
    int base=space/cnt;
    int rst=space % cnt;
    for (int i=0; i<cnt; i++) {
    result[i]=base;
    if (rst>0) {
    result[i]++;
    rst--;
    return result;
    public float getMinimumSpan(int axis) {
    if (axis==View.X_AXIS) {
    AttributeSet attr=getAttributes();
    if (StyleConstants.getAlignment(attr)!=StyleConstants.ALIGN_JUSTIFIED) {
    return super.getMinimumSpan(axis);
    else {
    return this.getParent().getMinimumSpan(axis);
    else {
    return super.getMinimumSpan(axis);
    public float getMaximumSpan(int axis) {
    if (axis==View.X_AXIS) {
    AttributeSet attr=getAttributes();
    if (StyleConstants.getAlignment(attr)!=StyleConstants.ALIGN_JUSTIFIED) {
    return super.getMaximumSpan(axis);
    else {
    return this.getParent().getMaximumSpan(axis);
    else {
    return super.getMaximumSpan(axis);
    public float getPreferredSpan(int axis) {
    if (axis==View.X_AXIS) {
    AttributeSet attr=getAttributes();
    if (StyleConstants.getAlignment(attr)!=StyleConstants.ALIGN_JUSTIFIED) {
    return super.getPreferredSpan(axis);
    else {
    return this.getParent().getPreferredSpan(axis);
    else {
    return super.getPreferredSpan(axis);
    public void setRowNumber(int value) {
    rowNumber=value;
    public int getRowNumber() {
    return rowNumber;
    public int getFlowSpan(int index) {
    int span=super.getFlowSpan(index);
    if (index==0) {
    int firstLineIdent=(int)StyleConstants.getFirstLineIndent(this.getAttributes());
    span-=firstLineIdent;
    return span;
    protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
    super.layoutMinorAxis(targetSpan, axis, offsets, spans);
    int firstLineIdent=(int)StyleConstants.getFirstLineIndent(this.getAttributes());
    offsets[0]+=firstLineIdent;
    protected static boolean isContainSpace(View v) {
    int startOffset=v.getStartOffset();
    int len=v.getEndOffset()-startOffset;
    try {
    String text=v.getDocument().getText(startOffset,len);
    if (text.indexOf(' ')>=0)
    return true;
    else
    return false;
    catch (Exception ex) {
    return false;

    I've managed to interpret what was in the POST and so just to help out here's how to get it all working:
    In a file called AdvancedParagraphView.java
    package .....<your package>.....
    import javax.swing.text.*;
    import java.awt.*;
    import javax.swing.*;
    public class AdvancedParagraphView extends ParagraphView {
      public AdvancedParagraphView(Element elem) {
        super(elem);
        strategy = new AdvancedFlowStrategy();
      protected View createRow() {
        Element elem = getElement();
        return new AdvancedRow(elem);
      protected static int getSpaceCount(String content) {
        int result = 0;
        int index = content.indexOf(' ');
        while (index >= 0) {
          result++;
          index = content.indexOf(' ', index + 1);
        return result;
      protected static int[] getSpaceIndexes(String content, int shift) {
        int cnt = getSpaceCount(content);
        int[] result = new int[cnt];
        int counter = 0;
        int index = content.indexOf(' ');
        while (index >= 0) {
          result[counter] = index + shift;
          counter++;
          index = content.indexOf(' ', index + 1);
        return result;
      static class AdvancedFlowStrategy
          extends FlowStrategy {
        public void layout(FlowView fv) {
          super.layout(fv);
          AttributeSet attr = fv.getElement().getAttributes();
          float lineSpacing = StyleConstants.getLineSpacing(attr);
          boolean justifiedAlignment = (StyleConstants.getAlignment(attr) ==
                                        StyleConstants.ALIGN_JUSTIFIED);
          if (! (justifiedAlignment || (lineSpacing > 1))) {
            return;
          int cnt = fv.getViewCount();
          for (int i = 0; i < cnt - 1; i++) {
            AdvancedRow row = (AdvancedRow) fv.getView(i);
            if (lineSpacing > 1) {
              float height = row.getMinimumSpan(View.Y_AXIS);
              float addition = (height * lineSpacing) - height;
              if (addition > 0) {
                row.setInsets(row.getTopInset(), row.getLeftInset(),
                              (short) addition, row.getRightInset());
            if (justifiedAlignment) {
              restructureRow(row, i);
              row.setRowNumber(i + 1);
        protected void restructureRow(View row, int rowNum) {
          int rowStartOffset = row.getStartOffset();
          int rowEndOffset = row.getEndOffset();
          String rowContent = "";
          try {
            rowContent = row.getDocument().getText(rowStartOffset,
                                                   rowEndOffset - rowStartOffset);
            if (rowNum == 0) {
              int index = 0;
              while (rowContent.charAt(0) == ' ') {
                rowContent = rowContent.substring(1);
                if (rowContent.length() == 0)
                  break;
          catch (Exception e) {
            e.printStackTrace();
          int rowSpaceCount = getSpaceCount(rowContent);
          if (rowSpaceCount < 1)
            return;
          int[] rowSpaceIndexes = getSpaceIndexes(rowContent, row.getStartOffset());
          int currentSpaceIndex = 0;
          for (int i = 0; i < row.getViewCount(); i++) {
            View child = row.getView(i);
            if ( (child.getStartOffset() < rowSpaceIndexes[currentSpaceIndex]) &&
                (child.getEndOffset() > rowSpaceIndexes[currentSpaceIndex])) {
    //split view
              View first = child.createFragment(child.getStartOffset(),
                                                rowSpaceIndexes[currentSpaceIndex]);
              View second = child.createFragment(rowSpaceIndexes[currentSpaceIndex],
                                                 child.getEndOffset());
              View[] repl = new View[2];
              repl[0] = first;
              repl[1] = second;
              row.replace(i, 1, repl);
              currentSpaceIndex++;
              if (currentSpaceIndex >= rowSpaceIndexes.length)
                break;
          int childCnt = row.getViewCount();
      class AdvancedRow
          extends BoxView {
        private int rowNumber = 0;
        AdvancedRow(Element elem) {
          super(elem, View.X_AXIS);
        protected void loadChildren(ViewFactory f) {
        public AttributeSet getAttributes() {
          View p = getParent();
          return (p != null) ? p.getAttributes() : null;
        public float getAlignment(int axis) {
          if (axis == View.X_AXIS) {
            AttributeSet attr = getAttributes();
            int justification = StyleConstants.getAlignment(attr);
            switch (justification) {
              case StyleConstants.ALIGN_LEFT:
              case StyleConstants.ALIGN_JUSTIFIED:
                return 0;
              case StyleConstants.ALIGN_RIGHT:
                return 1;
              case StyleConstants.ALIGN_CENTER:
                return 0.5f;
          return super.getAlignment(axis);
        public Shape modelToView(int pos, Shape a, Position.Bias b) throws
            BadLocationException {
          Rectangle r = a.getBounds();
          View v = getViewAtPosition(pos, r);
          if ( (v != null) && (!v.getElement().isLeaf())) {
    // Don't adjust the height if the view represents a branch.
            return super.modelToView(pos, a, b);
          r = a.getBounds();
          int height = r.height;
          int y = r.y;
          Shape loc = super.modelToView(pos, a, b);
          r = loc.getBounds();
          r.height = height;
          r.y = y;
          return r;
        public int getStartOffset() {
          int offs = Integer.MAX_VALUE;
          int n = getViewCount();
          for (int i = 0; i < n; i++) {
            View v = getView(i);
            offs = Math.min(offs, v.getStartOffset());
          return offs;
        public int getEndOffset() {
          int offs = 0;
          int n = getViewCount();
          for (int i = 0; i < n; i++) {
            View v = getView(i);
            offs = Math.max(offs, v.getEndOffset());
          return offs;
        protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets,
                                       int[] spans) {
          baselineLayout(targetSpan, axis, offsets, spans);
        protected SizeRequirements calculateMinorAxisRequirements(int axis,
            SizeRequirements r) {
          return baselineRequirements(axis, r);
        protected int getViewIndexAtPosition(int pos) {
    // This is expensive, but are views are not necessarily layed
    // out in model order.
          if (pos < getStartOffset() || pos >= getEndOffset())
            return -1;
          for (int counter = getViewCount() - 1; counter >= 0; counter--) {
            View v = getView(counter);
            if (pos >= v.getStartOffset() &&
                pos < v.getEndOffset()) {
              return counter;
          return -1;
        public short getTopInset() {
          return super.getTopInset();
        public short getLeftInset() {
          return super.getLeftInset();
        public short getRightInset() {
          return super.getRightInset();
        public void setInsets(short topInset, short leftInset, short bottomInset,
                              short rightInset) {
          super.setInsets(topInset, leftInset, bottomInset, rightInset);
        protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,
                                       int[] spans) {
          super.layoutMajorAxis(targetSpan, axis, offsets, spans);
          AttributeSet attr = getAttributes();
          if ( (StyleConstants.getAlignment(attr) != StyleConstants.ALIGN_JUSTIFIED) &&
              (axis != View.X_AXIS)) {
            return;
          int cnt = offsets.length;
          int span = 0;
          for (int i = 0; i < cnt; i++) {
            span += spans;
    if (getRowNumber() == 0)
    return;
    int startOffset = getStartOffset();
    int len = getEndOffset() - startOffset;
    String context = "";
    try {
    context = getElement().getDocument().getText(startOffset, len);
    catch (Exception e) {
    e.printStackTrace();
    int spaceCount = getSpaceCount(context) - 1;
    int pixelsToAdd = targetSpan - span;
    if (this.getRowNumber() == 1) {
    int firstLineIndent = (int) StyleConstants.getFirstLineIndent(
    getAttributes());
    pixelsToAdd -= firstLineIndent;
    int[] spaces = getSpaces(pixelsToAdd, spaceCount);
    int j = 0;
    int shift = 0;
    for (int i = 1; i < cnt; i++) {
    LabelView v = (LabelView) getView(i);
    offsets[i] += shift;
    if ( (isContainSpace(v)) && (i != cnt - 1)) {
    offsets[i] += spaces[j];
    spans[i - 1] += spaces[j];
    shift += spaces[j];
    j++;
    protected int[] getSpaces(int space, int cnt) {
    int[] result = new int[cnt];
    if (cnt == 0)
    return result;
    int base = space / cnt;
    int rst = space % cnt;
    for (int i = 0; i < cnt; i++) {
    result[i] = base;
    if (rst > 0) {
    result[i]++;
    rst--;
    return result;
    public float getMinimumSpan(int axis) {
    if (axis == View.X_AXIS) {
    AttributeSet attr = getAttributes();
    if (StyleConstants.getAlignment(attr) != StyleConstants.ALIGN_JUSTIFIED) {
    return super.getMinimumSpan(axis);
    else {
    return this.getParent().getMinimumSpan(axis);
    else {
    return super.getMinimumSpan(axis);
    public float getMaximumSpan(int axis) {
    if (axis == View.X_AXIS) {
    AttributeSet attr = getAttributes();
    if (StyleConstants.getAlignment(attr) != StyleConstants.ALIGN_JUSTIFIED) {
    return super.getMaximumSpan(axis);
    else {
    return this.getParent().getMaximumSpan(axis);
    else {
    return super.getMaximumSpan(axis);
    public float getPreferredSpan(int axis) {
    if (axis == View.X_AXIS) {
    AttributeSet attr = getAttributes();
    if (StyleConstants.getAlignment(attr) != StyleConstants.ALIGN_JUSTIFIED) {
    return super.getPreferredSpan(axis);
    else {
    return this.getParent().getPreferredSpan(axis);
    else {
    return super.getPreferredSpan(axis);
    public void setRowNumber(int value) {
    rowNumber = value;
    public int getRowNumber() {
    return rowNumber;
    public int getFlowSpan(int index) {
    int span = super.getFlowSpan(index);
    if (index == 0) {
    int firstLineIdent = (int) StyleConstants.getFirstLineIndent(this.
    getAttributes());
    span -= firstLineIdent;
    return span;
    protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets,
    int[] spans) {
    super.layoutMinorAxis(targetSpan, axis, offsets, spans);
    int firstLineIdent = (int) StyleConstants.getFirstLineIndent(this.
    getAttributes());
    offsets[0] += firstLineIdent;
    protected static boolean isContainSpace(View v) {
    int startOffset = v.getStartOffset();
    int len = v.getEndOffset() - startOffset;
    try {
    String text = v.getDocument().getText(startOffset, len);
    if (text.indexOf(' ') >= 0)
    return true;
    else
    return false;
    catch (Exception ex) {
    return false;
    In a file called FixedStyledEditorKit.java
    package .....<your package>.....
    import javax.swing.text.*;
    public class FixedStyledEditorKit extends StyledEditorKit {
      public ViewFactory getViewFactory() {
        return new FixedStyledViewFactory();
    }In a file called FixedStyledViewFactory.java
    package .....<your package>.....
    import javax.swing.text.*;
    public class FixedStyledViewFactory implements ViewFactory {
      public View create(Element elem) {
        String kind = elem.getName();
        if (kind != null) {
          if (kind.equals(AbstractDocument.ContentElementName)) {
            return new LabelView(elem);
          else if (kind.equals(AbstractDocument.ParagraphElementName)) {
    // return new ParagraphView(elem);
            return new AdvancedParagraphView(elem);
          else if (kind.equals(AbstractDocument.SectionElementName)) {
            return new BoxView(elem, View.Y_AXIS);
          else if (kind.equals(StyleConstants.ComponentElementName)) {
            return new ComponentView(elem);
          else if (kind.equals(StyleConstants.IconElementName)) {
            return new IconView(elem);
    // default to text display
        return new LabelView(elem);
    }I then used it with a JTextPane by putting:
    package ....<my package> ....
    JTextPane description = new JTextPane();
        description.setEditorKit(new FixedStyledEditorKit());

  • Numeric fields not aligned correctly in report preview

    Hi
    I have the next problem:
    On my report, I aligned the numeric fields to the right of a column, but when i run the preview on ASP, the numeric fields are aligned to the left.
    But when I export the report to PDF, the numbers align correctly.
    I figured out a workaround to this, introducing the numeric fields into text fields, since they do align correctly. The problem is that I have too many reports to apply this workaround to all of them.
    Could it be a known issue of Crystal Reports XI?
    Is there any other workaround?
    Thanks in advance

    Hi Poonam
    Maybe I wasn't quite explicit before,
    In preview mode my report displays correctly as well. The problem comes when I run it through an ASP, which is needed for my application.
    I'm running the CR version 11.5.0.313. I was asking if it could be a known issue of XI version because when I had version 9 I didn't have this problem.
    It could also be that through the time, I changed something in the way the report is displayed, and didn't realize about that before, but I haven't been lucky to notice any change related.
    Thanks for your time,
    Gil
    Edited by: Gil Gonzalez on Oct 21, 2008 12:11 AM

  • PanelLabelAndMessage not aligned in hierachical viewer until node is clicke

    Hi,
    I am using the DVT Hierarchical Viewer. Using the code below (which is similar to the the demo code). The Labels column is coming out zig-zagging (not aligned to the right) but the OutputText column comes out aligned correctly to the left. Once I select (put focus on the node), the label column aligned correctly.
    Can someone please tell me what I need to so that the nodes will render with the label column aligned.
    <af:panelFormLayout inlineStyle="padding:5px" id="pflc3" styleClass="AFStretchWidth">
    <af:panelLabelAndMessage label="Name" id="plmc3" >
    <af:goLink text="#{node.name}" id="gl2"
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage id="pn1" label="First Name">
    <af:outputText id="iii" value="#{node.firstName}" />
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage id="pn11" label="Last Name">
    <af:outputText id="iii1" value="#{node.lastName}" />
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage id="pn111" label="Email">
    <af:outputText id="iii11" value="#{node.email}" />
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage id="pn1112" label="Work Phone">
    <af:outputText id="iii112" value="#{node.phoneNumber}" />
    </af:panelLabelAndMessage>
    </af:panelFormLayout>

    Thanks for the suggestion David.  I tried that this morning but the issue still remained.  Are there any known issues with the latest 3.3 patch and the viewer?
    As an added note, the issue is not browser specific.  It happens in both IE and Firefox.
    Thank you.

  • Output is not aligning

    Hi,
    Can someone please tell me what I can do to make my output align correctly? I used Titanic and then Mission Impossible for the name of the DVD's and the output is all off. It's correct but not aligned right with the column headings.
    Thank you!!!
    import java.util.Scanner;
    import java.text.*;
    public class inventory
      public static void main(String[] args)
        //This will hold the product name
        String name;
        //This will hold the value number of products
        int numberofproducts;
        //Creates a Scanner object to read input
        Scanner input = new Scanner(System.in);
        //Creating a number format instance to make pay print with 2 decimal digits
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(2);      ; ;
        //prompting user to enter number of products (array size)
        System.out.print("Enter the number of products:  ");
        numberofproducts = input.nextInt();
        //creating an array of products to store information in
        DVD[] productarray = new DVD[numberofproducts];
        //This will loop until the number of products is 0
        for(int j = 0; j < numberofproducts; j++)
            productarray[j] = new DVD();
          //prompting user to enter product name
          System.out.print("Enter the DVD Title:  ");
          input.nextLine();
          //reading user's input
          productarray[j].setName(input.nextLine());
          //prompting user to enter the product number
          System.out.print("Enter the product number for " + productarray[j].getName() + " :  ");
          //reading user's input
          productarray[j].setProductnumber(input.nextInt());
          //prompting user to enter the price per unit
          System.out.print("Enter the price per unit for " + productarray[j].getName() + " :  ");
          //reading user's input
          productarray[j].setPriceperunit(input.nextDouble());
          //prompting user for the number of units
          System.out.print("Enter the number of units " + productarray[j].getName() + " on hand: ");
          //reading user's input
          productarray[j].setNumberofunits(input.nextInt());
           //Calculating the Value of Invetory
          nextProduct.setValueofinventory(nextProduct.getPriceperunit() * nextProduct.getNumberofunits());
          grandTotal += nextProduct.getValueofinventory();
          productarray[i] = nextProduct;
          input.nextLine();
        }//end for loop
        //Displaying the Inventory
        System.out.println("Item #\tName\tProduct #\t# of Units\tUnit Cost\tTotal Cost");
        for(int j = 0; j < numberofproducts; j++)
            System.out.print((j + 1) + "\t" + productarray[j].getName() + "\t" + productarray[j].getProductnumber() + "\t\t");
            System.out.print(productarray[j].getNumberofunits() + "\t\t$" + nf.format(productarray[j].getPriceperunit()) + "\t\t$");
            System.out.println(nf.format(productarray[j].getValueofinventory()));
        }//end for loop
    System.out.println("The Value of the entire inventory is:  " + "$" + grandTotal );
      }//end main method
    }//end class inventory
    class DVD extends product
        private double valueofinventory;
        private double restockingfee;
        public DVD()
        }//end constructor
      //sets the valueofinventory variable plus a 5% restocking fee
      public void setValueofinventory(double valueofinventory)
            restockingfee = valueofinventory * .05;
        this.valueofinventory = valueofinventory * 1.05;
      }//end setValueofinventory
      //returns the valueofinventory value
      public double getValueofinventory()
          return valueofinventory;
      }//end getValueofinventory
      //returns the restockingfee value
      public double getRestockingfee()
          return restockingfee;
      }//end getRestockingfee
    }//end class DVD
    //This class will hold the information for the product
    class product
      //This will hold the product name
      private String name;
      //This will hold the values for product number, price of each unit, and number of units in stock
      private int productnumber, numberofunits;
      //This will hold the price of each unit
      private double priceperunit, valueofinventory;
        public product()
        }//end constructor
        //Sets the name variable
        public void setName(String name)
            this.name = name;
        }//end setName
        //returns the string value for Name
        public String getName()
            return name;
        }//end getName
        //sets the productnumber variable
        public void setProductnumber(int productnumber)
            this.productnumber = productnumber;
        }//end setProductNumber
        //returns the integer assigned to productnumber
        public int getProductnumber()
            return productnumber;
        }//end getProductnumber
        //sets the priceperunit variable
        public void setPriceperunit(double priceperunit)
            this.priceperunit = priceperunit;
        }//end setPriceperunit
        //returns the priceperunit value
        public double getPriceperunit()
            return priceperunit;
        }//end getPriceperunit
        //sets the valueofinventory variable
        public void setValueofinventory(double valueofinventory)
            this.valueofinventory = valueofinventory;
        }//end setValueofinventory
        //returns the valueofinventory value
        public double getValueofinventory()
            return valueofinventory;
        }//end getValueofinventory
        //sets the numberofunits variable
        public void setNumberofunits(int numberofunits)
            this.numberofunits = numberofunits;
        }//end setNumberofunits
        //returns the numberofunits value
        public int getNumberofunits()
            return numberofunits;
        }//end getNumberofunits
    }//end class product

    Java is not actually designed and developed for stand alone console application. So you cannot expect output in console as you thought. There may be third party utilities for your needs. Just google it. You can use your own logic to do this. It is not difficult. Anyhow I include this code here. This would be helpful I hope.
    public static String padAlign(String string, int fieldLength, char padding, boolean alignRight)
    int length = fieldLength - string.length();
    if (length <= 0)
    return string.substring(0,string.length());
    StringBuffer buffer = new StringBuffer(fieldLength);
    for(int i=0; i<length; i++)
    buffer.append(padding);
    if (alignRight)
    buffer.append(string);
    else
    buffer.insert(0,string);
    return new String(buffer);
    public static void main(String[] args)
    System.out.println(padAlign("Test",20,' ',true)+" "+padAlign("Test again",20,' ',true));
    System.out.println("--------------------|--------------------|");
    System.out.println(padAlign("Test",20,' ',false)+" "+padAlign("Test again",20,' ',false));
    }

  • Paragraphs do not align to grid

    Hello there:-)
    I created a baseline grid of 6pt, body text 12pt, head lead 12pt, space before and space after 12pt and 6pt. In one chapter, everything aligns, in the second one the paragraphs do not align. I'm going back and forth the paragraph style to change the space before and after of the head, but everything is still the same. What am I doing wrong?
    Any help is appreciated.

    saranas wrote:
    I think you're right. Could you please give an example of how to do this "Unless the total of the leading, space before, and space after total an increment of 12 you'll be off grid."? I just need to see some numbers to see whether I can correct this.
    Many thanks.
    Well, in all honesty there's no way to do this so that you always have grid alignement and consistent spacing between the headings and and the body text unless they all use a leading value that's a multiple of 12 and all space before/space after is also a multiple of 12 (or whatever number you've chosen for the leading or the body text).  As soon as you introduce an odd number you're going to wind up with a larger space below a heading (usually at the top of the page), or a misalignment.
    On the other hand, if youy keep everything in multiples of the same body text leading value, you don't need a grid to maintain alignment.

Maybe you are looking for

  • My hard drive fried, and I need to transfer files from iPod to My Music

    I've seen articles on transferring music from an old computer to a new one when you still have the old computer. But, my hard drive completely fried, and I need to know how to transfer the files from my iPod to the new hard drive. I thought I saw an

  • How can I get a DNS on a virtual network to resolve hostnames on a point-to-site machine?

    Hello, I set up an Azure virtual network with the following configuration: 1 Windows DNS Server (Local IP: 10.0.1.4) 1 Windows Server (Local IP: 10.0.1.5, FQDN: perforce.redbyte.com) 1 Ubuntu Server (Local IP: 10.0.1.6, FQDN: swarm.redbyte.com) From

  • Use of video effects

    I wonder if there's a novice out there like me who has tried to edit effects for an old VHS and found some short cuts?  eg. I have an video that's only about 20 years old but because it was taken inside at night it's quite dark and grainy, not to men

  • String inserted into an existing string

    Hi All, I am trying to insert a string into the middle of another string. Does anyone know how I can do this. Basically what I want to do is this..insert the contents of the second string(str2) before the <Envelope> tag in the first string(str1): Str

  • Why don't I see the "custom scale" option when I print?

    When printing PDF files using Adobe Reader 10.1.6 I do not have the custom scale option. Is this not available in this version? lagoliff