Attachments (pdf- doc- xla- ppt...) in PDF

Here’re the codes:





Dim filePathName, progid As String

Dim MyDir As String = “C:\VS2012”

Dim doc As New Aspose.Words.Document(MyDir + “inFile.docx”)

Dim docBuilder As DocumentBuilder = New DocumentBuilder(doc)

filePathName = MyDir + “MyPPTTestFile.ppt”

progid = “PowerPoint.Show.8”



Using stream As New MemoryStream(File.ReadAllBytes(filePathName))

docBuilder.InsertOleObject(stream, progid, True, Nothing)

End Using



Dim dataDir As String = “C:\VS2012\outFileWithPPTAttachment.docx”

’ Save the document to disk.

doc.Save(dataDir)

Hi Dzung,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14110. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.
Hi Dzung,

Thanks for your patience. It is to inform you that our product team has completed the work on issue (WORDSNET-14110) and has come to a conclusion that this issue and the undesired behavior you're observing is actually not a bug in Aspose.Words. So, we have closed this issue as 'Not a Bug'.

You are using "PowerPoint.Show.8" in the code and your PowerPoint file is actually PowerPoint 12 document. So, please use ProgId as "PowerPoint.Show.12" in your code to fix the exception issue.

I generate a cover letter with header and footer.
At the end of header, I set the page break
docBuilder.InsertBreak(BreakType.SectionBreakContinuous)

I got this error :

Cannot insert the requested break outside of the main story

Hi Dzung,

Thanks for your inquiry. You cannot insert the page break inside header/footer. You need to move the cursor to the body of section and then insert page break. Please use DocumentBuilder.MoveToSection method to move the cursor to the beginning of the body in a specified section. Hope this helps you.

I have a datatable and want to export it to the excel file.

Can I do that with Aspose.WORD ?
thanks

Hi,


Well, you need to use Aspose.Cells APIs, see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Import+and+Export+Data

Thank you.

I had a special pdf file with all formats as a form, I want to read it, populate data from Oracle database and insert video such as .wmv, .mp3, .mp4 files to this pdf file.



is it possible? if so, please provide VB.net examples .

thanks

Hi,

Thanks for contacting support.

Aspose.PDF for .NET offers the feature to create as well as fill PDF forms. You can read data from database and use it to fill PDF form. Please take a look over following code snippets.

VB,NET code to Fill Form Fields

’Open document
Dim pdfDocument As Document = New Document("FillFormField.pdf")

' Get a field
Dim textBoxField As Aspose.Pdf.Forms.TextBoxField = pdfDocument.Form("textbox1") As Aspose.Pdf.Forms.TextBoxFieldTextBoxField

' Modify field value
textBoxField.Value = "Value to be filled in the field"

' Save updated document
pdfDocument.Save("c:/pdftest/FilledForm.pdf")

VB.NET code to Add attachment to PDF file

’ file attachment annotation, using DOM
Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document("c:/pdftest/MarginsPdf.pdf")

' get instance of first page of the document
Dim firstPage As Aspose.Pdf.Page = doc.Pages(1)

' create FileSpecification objecgt
Dim fs As Aspose.Pdf.FileSpecification = New Aspose.Pdf.FileSpecification("C:\IF Pull 3-1-2017.mp4", "MP4")

' create File Attachment Annotation object
Dim fileAnnot As Aspose.Pdf.Annotations.FileAttachmentAnnotation = New Aspose.Pdf.Annotations.FileAttachmentAnnotation(firstPage, New Aspose.Pdf.Rectangle(0, 0, 100, 100), fs)

' add annotation to annotations collection of PDF file
firstPage.Annotations.Add(fileAnnot)

' save PDF document
doc.Save("c:/pdftest/MarginsPdf_mp4.pdf")

The issues you have found earlier (filed as WORDSNET-14001) have been fixed in this Aspose.Words for .NET 22.11 update also available on NuGet.