I require to combine my word documents to one document. Does the current version support direct combining of documents, like doc.Append(anotherDoc) ? Or is it possible to add “Filialdokumente” (sorry, I don’t know the english synonym for that)?
If not I will have to copy/move the sections, right? I read in another thread posted here that the overall size of such “combined” documents (or any document at all) is restricted to a size barrier. Has this changed?
private void AppendDoc(Document dstDoc, Document srcDoc)
{
for (int i = 0; i < srcDoc.Sections.Count; i++)
{
//First need to import the section into the destination document,
//this translates any document specific lists or styles.
Section section = (Section)dstDoc.ImportNode(srcDoc.Sections, true);
dstDoc.Sections.Add(section);
}
}
I have included a reference in my project and added the namespace to my
class by “using Aspose;” but I am constantly being told that Document
is not a namespace or object, Section is not a namespace, reference or
object etc etc etc.
And I even get told that is not a namespace.
Any help?
p.s. can an option be added to these forums in order to remove the emoticons from posts.
Thanks, I am still not able to get this to work however.
This is what I have placed as my code,
private void AppendDoc(Document dstDoc, Document srcDoc)
{
for (int i = 0; i < srcDoc.Sections.Count; i++)
{
//First need to import the section into the destination document,
//this translates any document specific lists or styles.
Section section = (Section)dstDoc.ImportNode(srcDoc.Sections, true);
dstDoc.Sections.Add(section);
}
}
private void btnFinish_Click(object sender, System.EventArgs e)
{
// Main Build and Retrieval Area!!
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Specify font formatting for the hyperlink.
builder.Font.Color = System.Drawing.Color.Black;
// Display our selected vars.
builder.Writeln(mySource);
builder.Writeln(myDest);
builder.Writeln(myInitials);
builder.Writeln(myName);
builder.Writeln(myPeriod);
string myDesktop = "C:\\Documents and Settings\\Administrator\\Desktop";
string fn1 = myDesktop + "\\" + "doc1.doc";
string fn2 = myDesktop + "\\" + "doc2.doc";
Document doc1 = new Document(fn1);
Document doc2 = new Document(fn2);
AppendDoc(doc1, doc2);
doc.Save("C:\\Documents and Settings\\Administrator\\Desktop\\testing.doc");
this.Close();
}
Please ignore the references to the 5 myVars in the writeln functions.
My main problem is that doc1 and doc2 are not being inserted into the
new document.