Hi Awais,
Thanks for the reply. I understood that paragraph can contain text in the form of Run.Text. My doubts are
- Pargraph-> Run-> Text
Paragraph->Shape
Paragraph-> Shape-> Paragraph-> Run -> Text
These are the three ways i found for paragraph for my source doc. Now what i am concerned is if i encountered a shape and without modifying anything if i want to copy/paste to target document is it possible? Like if there is some drawing object in source doc without modifying just cop/paste or if there is some image copy/paste to target doc.
- Copying paragraph is possible or not?
Paragraph p=new Paragraph(targetDoc);
p=sourceDoc.sections[0].body.paragraphs[0];
I tried this but it’s giving exception saying node is created from some different doc.
If this is not possible is there any way just to copy/paste paragraph because in some cases i don’t want to modify paragraphs from source doc so will just read from source doc and will paste to target doc.
It would help me if you can give some kind of code for it just to get an idea.
You can refer source.doc and destination.doc file i sent you earlier. to get an idea of my 2 issues mentioned above.
Regarding Language translation: Just to check whether it works or not i created sample code as below
String fileName = "C:\testing.doc";
Document source = new Document(fileName);
Document tt = new Document();
tt.RemoveAllChildren();
//Create section for target doc
Section section = new Section(tt);
tt.AppendChild(section);
//Create body for target doc
Body body = new Body(tt);
section.AppendChild(body);
Paragraph p1=new Paragraph(tt);
body.AppendChild(p1);
Run r =new Run(tt);
r.Text = "some text in other language"
p1.AppendChild®;
Console.ReadLine();
tt.Save("C:\testing2.doc");
SourceFile Content:
The Service Location Protocol (SLP)** is a service discovery protocol that allows computers and other devices to find services in a LAN without prior configuration. Since the current implementation of SLP is limited to LAN and is not scable to internet, we offer an implementation that provides similar functionality as that of SLP in a cloud that helps client to select the most appropriate service.
Destination File Content:
Evaluation Only. Created with Aspose.Words. Copyright 2003-2011 Aspose Pty Ltd.
सेवा स्थान प्रोटोकॉल (SLP) एक सेवा डिस्कवरी प्रोटोकॉल है कि अनुमति देता है (In place of this i am getting boxes which should not be as when i am using interop API, it’s able to show me the same text in the language i have translated like shown here)
So it’s able to convert but not able to show…
Also one more thing, even though i am using entire paragraph range, it’s taking only first line of it.
Console.WriteLine(source.Sections[0].Body.Paragraphs[1].Range.Text);
this one should return entire paragraph but its giving only first line : The Service Location Protocol (SLP)** is a service discovery protocol that
allows