Attachments display row wise

Received : 2007/12/08 04:03:51
Message : HI,
I am attaching multiple attachment to pdf file, attachment successfully, but the attachment link icons didn't display the attachment name, and each attachment displayed in the new row. Help me out to display these attachments in comma seperated.


This message was posted using Aspose.Live 2 Forum

Hi,

Thank you for considering Aspose.

Can you please provide your code and the resulting PDF document?

Hi,

You can display the name of attachment or any other info by setting the NoteContent property. Attachments are implemented in the form of paragraphs and hence you can only have one per line. As a work arround please use a table. Please see the following example:

Pdf pdf1 = new Pdf();

Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();

sec1.Paragraphs.Add(table1);

Aspose.Pdf.Row row1 = table1.Rows.Add();

Aspose.Pdf.Cell cell1Row1 = row1.Cells.Add();

Attachment fileAttachment = new Attachment();

cell1Row1.Paragraphs.Add(fileAttachment);

fileAttachment.AttachmentType = AttachmentType.File;

fileAttachment.AttachedFileName = "test.tiff";

fileAttachment.AttachedFileType = "tif";

fileAttachment.FileIconType = FileIconType.Graph;

fileAttachment.IconColor = new Aspose.Pdf.Color("Brown");

fileAttachment.NoteContent = "Attachment 1";

Aspose.Pdf.Cell cell2Row1 = row1.Cells.Add();

Attachment fileAttachment2 = new Attachment();

cell2Row1.Paragraphs.Add(fileAttachment2);

fileAttachment2.AttachmentType = AttachmentType.File;

fileAttachment2.AttachedFileName = "test.tiff";

fileAttachment2.AttachedFileType = "tif";

fileAttachment2.FileIconType = FileIconType.Graph;

fileAttachment2.IconColor = new Aspose.Pdf.Color("Brown");

fileAttachment2.NoteContent = "Attachment 2";

pdf1.Save("test.pdf");

Thanks.