Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Cell Text Wrap issues

Last post 09-19-2011, 10:20 AM by aspose.notifier. 8 replies.
Sort Posts: Previous Next
  •  08-11-2010, 4:47 PM 253511

    Cell Text Wrap issues Java

    Attachment: Present (inaccessible)

    I am creating a pdf page using the table structures for pdf. When I enter large amounts of text in the cell, the word wrapping does not always break at white space. As you can see in the example there are several words that get split in the middle at the end of a line. Here is the section of code that is creating the table:

    // Begin Work Experience Section

    if (f.isExperience()) {

    //get the employee's experiences

    List<ExperienceEntity> experienceList = experienceBO.getActiveExperiences(candidate.getUidKey());

    String categoryLabel1, categoryLabel2, categoryLabel3, categoryLabel4;

    String experienceLevel04 = "";

    if (experienceList != null && experienceList.size() > 0) {

    Table experienceTable = new Table();

    experienceTable.getDefaultCellPadding().setLeft(1);

    experienceTable.getDefaultCellPadding().setRight(1);

    experienceTable.getDefaultCellPadding().setTop(1);

    experienceTable.getDefaultCellPadding().setBottom(1);

    sec1.getParagraphs().add(new Text("",dataTI));

    sec1.getParagraphs().add(experienceTable);

    experienceTable.setColumnWidths("20% 30% 20% 30%");

    for (int i=0;i<experienceList.size();i++) {

    ExperienceEntity current = experienceList.get(i);

    String title = "";

    if (i == 0) {

    title = "Current Assignment";

    } else {

    title = "Previous Assignment " + i;

    }

    experienceLevel04 = current.getLevel04Id();

    categoryLabel1 = getCategoryLabel(request,experienceLevel04,"1") + ":";

    categoryLabel2 = getCategoryLabel(request,experienceLevel04,"2") + ":";

    categoryLabel3 = getCategoryLabel(request,experienceLevel04,"3") + ":";

    categoryLabel4 = getCategoryLabel(request,experienceLevel04,"4") + ":";

    row = experienceTable.getRows().add();

    titleCell = row.getCells().add(title, titleTI);

    titleCell.setColumnsSpan(4);

    titleCell.setBackgroundColor(tableHeaderBackground);

    titleCell.setVerticalAlignment(VerticalAlignmentType.Center);

    titleCell.getPadding().setTop(2);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add("Level 04:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    labelCell.getPadding().setTop(2);

    dataCell = row.getCells().add(current.getLevel04().getDescription(), dataTI);

    dataCell.getPadding().setTop(2);

    labelCell = row.getCells().add("Date of Position:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    labelCell.getPadding().setTop(2);

    dataCell = row.getCells().add(current.getFromDateDisplay() + " to " + current.getToDateDisplay(), dataTI);

    dataCell.getPadding().setTop(2);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add("Product Line:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getProductLine().getName(), dataTI);

    labelCell = row.getCells().add(categoryLabel1, labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getRole().getName(), dataTI);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add("Program:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getProgram().getName(), dataTI);

    labelCell = row.getCells().add("Job Title:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getJobTitle(), dataTI);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add(categoryLabel2, labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getIntegrationLevel().getName(), dataTI);

    labelCell = row.getCells().add("Manager:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getPositionManager(), dataTI);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add(categoryLabel4, labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getContractValue().getName(), dataTI);

    if (certificationLevel05List != null) {

    labelCell = row.getCells().add("Associated Certifications", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getAssociatedLevel05ReportDisplay(), dataTI);

    } else {

    labelCell = row.getCells().add("", labelTI);

    dataCell = row.getCells().add("", dataTI);

    }

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add(categoryLabel3, labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    StringBuilder customerBuilder = new StringBuilder();

    for (CustomerEntity currentCustomer : current.getActiveCustomers()) {

    if (!customerBuilder.toString().equals("")) {

    customerBuilder.append("; ");

    }

    customerBuilder.append(currentCustomer.getName());

    }

    dataCell = row.getCells().add(customerBuilder.toString(), dataTI);

    dataCell.setColumnsSpan(3);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add("Job Description:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getPositionDetails(), dataTI);

    dataCell.setColumnsSpan(3);

    row = experienceTable.getRows().add();

    labelCell = row.getCells().add("Describe Experience:", labelTI);

    labelCell.setAlignment(AlignmentType.Right);

    dataCell = row.getCells().add(current.getDescription(), dataTI);

    dataCell.setColumnsSpan(3);

    }

    }

    // End Work Experience Section

    Is there a word wrap setting that I am missing?

    Thank you for your time.

     
  •  08-12-2010, 12:42 PM 253647 in reply to 253511

    Re: Cell Text Wrap issues

    Attachment: Present (inaccessible)

    Hello Benjamin,

    Thanks for using our products.

    I have tested the scenario using following code snippet (extracted from you original code) while using Aspose.Pdf for Java 2.7.0 and I am unable to notice the problem. The resultant PDF that I have generated is also in attachment, please take a look. Can you please share which version of Aspose.Pdf for Java you are using ?

    In case you are using v2.7.0, then please share the code snippet regarding TextInfo for Data element. I am afraid the information regarding dataTI is not present in above specified code.

    We apologize for your inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  08-12-2010, 2:23 PM 253665 in reply to 253647

    Re: Cell Text Wrap issues

    I am running Aspose Pdf.Java 2.6.0. Should I download v2.7.0?

    I have noticed that the text break happens when there are large amounts of text places in the cell usually >= 3000 characters.

    aspose.pdf.Pdf.version is showing that it has been depricated. Is there a new way to find the version?

    Thank you,

    Benjamin

     
  •  08-13-2010, 5:50 AM 253786 in reply to 253665

    Re: Cell Text Wrap issues

    Hello Benjamin,

    Please try using the latest release version 2.7.0 which can be downloaded from this link.

    I have also tried placing more than 3000 characters inside table cell and I am still unable to notice any problem. However, regarding Pdf.Version(..) method, the method is deprecated but still you can use it. It can still display the version information of product.

    In case you still face any problem, please feel free to contact. We apologize for your inconvenience.

    PS, I have tested the scenario over Windows XP with JDK 1.6.0_21.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  08-26-2010, 3:53 PM 255841 in reply to 253786

    Re: Cell Text Wrap issues

    Attachment: Present (inaccessible)

    I have downloaded and included the latest pdf jar in our project. Running the Pdf.version() shows  - Aspose Pdf.Java 2.7.0

    I have attached a copy of the pdf that was generated using the latest library that shows the incorrect wrapping.

    This is occurring on both Windows XP and Unix systems running JDK 1.6.0_20.

    Thanks,

    Benjamin

     
  •  08-27-2010, 7:05 AM 255945 in reply to 255841

    Re: Cell Text Wrap issues

    Hello Benjamin,

    Thanks for sharing the information.

    Can you please test the code snippet that I have shared earlier at your end and share your findings ? I am afraid when I have used the same code at my end, I am unable to notice the problem. Or can you please update the code snippet accordingly so that we can reproduce the problem here ?

    We apologize for your inconvenience.

    PS, Until or unless we are able to reproduce the problem, we might not be able to figure out the actual reasons of this issue.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  08-27-2010, 9:55 AM 255974 in reply to 255945

    Re: Cell Text Wrap issues

    Attachment: Present (inaccessible)

    I used your enclosed snippet and once I put a long enough string in the field it did the incorrect string wrapping. I have attached a copy of the generated pdf and the code snippet with the string that caused the incorrect wrapping. You will notice that on line 6 of the pdf file the word "vested" is split and on line 8 the word "House" is split.

    Thank you,

    Benjamin

     
  •  08-27-2010, 11:45 AM 255990 in reply to 255974

    Re: Cell Text Wrap issues

    Hello Benjamin,

    Thanks for updating the code snippet.

    I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFJAVA-19647. We will investigate this issue in details and will keep you updated on the status of a correction.

     

    We apologize for your inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  09-19-2011, 10:20 AM 330281 in reply to 253511

    Re: Cell Text Wrap issues

    The issues you have found earlier (filed as 19647 ) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
View as RSS news feed in XML