merge documents with same pages

Last post 01-19-2010, 10:19 AM by aspose.notifier. 8 replies.
Sort Posts: Previous Next
  •  11-02-2009, 6:56 AM 205219

    merge documents with same pages .NET

    Attachment: Present (inaccessible)
    Hi,

    I need to merge two documents with their own pages, like please find my attachment having 5 pages with two orientations. The last page itself is a different document having its own header and page orientation but footer was common to entire document after merging. Could you please suggest me on this how to this?

    Thanks,

    Srinu Dhulipalla
    Filed under: append documents
     
  •  11-02-2009, 8:06 AM 205236 in reply to 205219

    Re: merge documents with same pages

    Hi

     

    Thanks for your request. In footers of both sections in your document you have PAGE and NUMPAGES fields. MS Word updates these fields automatically, when you open your document.

    You can try setting RestartPageNumbering property:

    http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.pagesetup.restartpagenumbering.html

     

    Hope this helps.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  11-02-2009, 8:45 AM 205245 in reply to 205236

    Re: merge documents with same pages .NET

    Hi Alexey,

    Thanks for your response, my intention was combining two documents where one document having page orientation as Landscape and other on is normal document, So i need to combine these two documents where starting pages should have normal document and last pages have Landscape document as my document attached earlier. Let suppose,

    Document doc1 =new document();
    doc1builder1.Writeln("first line");

    Document doc2 =new document();
    doc2builder2.PageSetup.ClearFormatting();
    doc2builder2.InsertBreak(BreakType.SectionBreakNewPage);
    doc2builder2.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;
    doc2builder2.PageSetup.VerticalAlignment = PageVerticalAlignment.Center;
    doc2builder2.Writeln("second line.");

    So now i need to combine these doc1 and doc2, the output document should have doc1 pages are starting pages and doc2 pages are last pages.

    Could you please suggest on this?

    Thanks,

    Srinu Dhulipalla
    Filed under: combine docs
     
  •  11-02-2009, 9:05 AM 205253 in reply to 205245

    Re: merge documents with same pages

    Hi

     

    Thanks for your inquiry. You can use Document.AppendDocument method to achieve this. Please see the following code:

     

    // Open source and destination documents.

    Document dst = new Document(@"Test001\dst.doc");

    Document src = new Document(@"Test001\src.doc");

     

    dst.AppendDocument(src, ImportFormatMode.UseDestinationStyles);

    dst.Save(@"Test001\out.doc");

     

    Hope this helps.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  11-03-2009, 1:32 AM 205396 in reply to 205253

    Re: merge documents with same pages

    Hi Alexey,

    Thanks for your response,

    Some times i am getting this error, when i am using above code:

    Item has already been added. Key in dictionary: 'DocumentName1' Key being added: 'DocumentName1' at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at System.Collections.Hashtable.Add(Object key, Object value) at ᰗ.ᢋ.ᰨ(Int32 ᡴ, String ހ, Int32 ֧) at ᰗ.ᢋ.ᰢ(ᢋ ږ, Int32 ᰣ) at ㋟.㌚.㌥() at ㋟.㋞.㋵() at ㋟.㋞.〈(⍝ 〉) at Aspose.Words.Document.ԅ(Stream Ӿ, String Ӽ, SaveFormat Ԇ) at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat) at Aspose.Words.Document.Save(String fileName)

    Shall i know why this was happening and how to overcome this one?

    Thanks,

    Srinu Dhulipalla
    Filed under: merge docs
     
  •  11-03-2009, 2:20 AM 205411 in reply to 205396

    Re: merge documents with same pages

    Hi

     

    Thanks for your request. Which version of Asopose.Words do you use for testing? To check version of the library, right click on the dll, select Properties from the context menu, then select Version tab. You will see File version.

     

    Could you please also provide me sample documents and code, which will allow me to reproduce the problem on my side?

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  11-03-2009, 3:13 AM 205423 in reply to 205411

    Re: merge documents with same pages .NET

    Attachment: Present (inaccessible)
    HI Alexey,

    Thanks for your response, i am using latest Aspose.Words 7.0.0.0 and here is the code and sample docs where i am getting the problem.

    Document dst = new Document(@"D:\Final\src1.doc");
                Document src = new Document(@"D:\Final\src2.doc");
                dst.AppendDocument(src, ImportFormatMode.UseDestinationStyles);
                dst.Save(@"D:\Final\Final.doc");

    Thanks,

    Srinu Dhulipalla
    Filed under: append documents
     
  •  11-03-2009, 3:36 AM 205427 in reply to 205423

    Re: merge documents with same pages

    Hi

     

    Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

    The problem occurs because your destination and source documents contain bookmarks with the same name. As a workaround, you can try removing bookmarks before appending a document.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  01-19-2010, 10:19 AM 217869 in reply to 205219

    Re: merge documents with same pages

    The issues you have found earlier (filed as 10653) 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