We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Row span for image not working

Hi ,

Please find my sample code.I have to span the image to next 2 rows and the code is not working.Please help.I have to address this immediately

It is noticed that the rowspan for cell is working for TextFragement.(See underlined commented code )

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import com.aspose.pdf.CellBorderStyle;

import com.aspose.pdf.Color;

import com.aspose.pdf.Document;

import com.aspose.pdf.Image;

import com.aspose.pdf.License;

import com.aspose.pdf.MarginInfo;

import com.aspose.pdf.Page;

import com.aspose.pdf.PageInfo;

public class TestAsposeImageSpan {

public static void main(String[] args) throws FileNotFoundException {

java.util.Locale locale1 = new java.util.Locale("en");

java.util.Locale.setDefault(locale1);

License lic = new License();

lic.setLicense(new FileInputStream(

"D:\\Workspaces\\Examples\\Aspose\\src\\conf\\Aspose.Total.Java.lic"));

// Added document

Document doc = new com.aspose.pdf.Document();

PageInfo pageInfo = doc.getPageInfo();

MarginInfo marginInfo = pageInfo.getMargin();

marginInfo.setLeft(37);

marginInfo.setRight(37);

marginInfo.setTop(37);

marginInfo.setBottom(37);

pageInfo.isLandscape(true);

com.aspose.pdf.Table table = new com.aspose.pdf.Table();

table.setColumnWidths("50 100");

// added page.

Page curPage = doc.getPages().add();

for(int i=1;i<=3;i++){

CellBorderStyle style = new CellBorderStyle(Color.getRed());

style.setLineWidth(2f);

com.aspose.pdf.Row row = table.getRows().add();

row.setFixedRowHeight(15);

com.aspose.pdf.Cell cell1 = row.getCells().add();

//cell1.setBorder(new BorderInfo(BorderSide.All,style));

cell1.getParagraphs().add(new com.aspose.pdf.TextFragment("Content 1"));

com.aspose.pdf.Cell cell2 = row.getCells().add();

//cell2.setBorder(new BorderInfo(BorderSide.All,style));

if(i==1 ){

Image image = new Image();

image.setImageStream(new FileInputStream("boys.jpg"));

cell2.setRowSpan(2);

cell2.getParagraphs().add(image);

/*cell2.setRowSpan(2);

cell2.getParagraphs().add(new com.aspose.pdf.TextFragment("Span please"));*/

}else{

cell2.getParagraphs().add(new com.aspose.pdf.TextFragment(""));

}

}

curPage.getParagraphs().add(table);

doc.save("ImageSpan.pdf");

}

}

Hi Basil,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for Java 4.5.1, We have managed to reproduce the reported row span issue with image and logged it in our bug tracking system as PDFNEWJAVA-34042 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-34042) have been fixed in Aspose.Pdf for Java 11.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.