Hello,
- Aspose.Words generated output document which shows the undesired behavior
- Please create a standalone Console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.
Hi ,
- Inserting unwanted additional break line after the first line of the file when converted from .dotm to RTF
- Not maintaining the original font when converted from .dotm to RTF
Hi Ashok,
Hi Ashok,
{
List<AutoText> result = new List<AutoText>();
Document srcDoc = new Document(template);
Document dstDoc = (Document)srcDoc.Clone();
dstDoc.RemoveAllChildren();
dstDoc.EnsureMinimum();
DocumentBuilder builder = new DocumentBuilder(dstDoc);
Node insertAfterNode = builder.CurrentParagraph;
bool inEntry = false;
foreach (Aspose.Words.BuildingBlocks.BuildingBlock b in srcDoc.GlossaryDocument.BuildingBlocks)
{
inEntry = false;
if (b.Gallery.ToString() == "AutoText")
{
foreach (Section srcSection in b.Sections)
{
CompositeNode dstStory = insertAfterNode.ParentNode;
NodeImporter importer = new NodeImporter(srcDoc.GlossaryDocument, insertAfterNode.Document, ImportFormatMode.UseDestinationStyles);
foreach (Node srcNode in srcSection.Body)
{
if (srcNode.NodeType.Equals(NodeType.Paragraph))
{
Paragraph para = (Paragraph)srcNode;
if (para.IsEndOfSection && !para.HasChildNodes)
continue;
}
Node newNode = importer.ImportNode(srcNode, true);
builder.MoveTo(insertAfterNode);
if (!inEntry) builder.CurrentParagraph.ParentNode.InsertAfter(newNode, builder.CurrentParagraph);
else builder.CurrentParagraph.ParentNode.InsertAfter(newNode, builder.CurrentParagraph.ParentNode.LastChild);
inEntry = true;
}
}
if (inEntry)
{
using (MemoryStream rtfStream = new MemoryStream())
{
dstDoc.FirstSection.Body.FirstParagraph.Remove();
dstDoc.Save(rtfStream, Aspose.Words.SaveFormat.Rtf);
result.Add(new AutoText
{
Name = b.Name,
Description = string.IsNullOrEmpty(b.Description) ? b.Name : b.Description,
Content = System.Text.Encoding.UTF8.GetString(rtfStream.ToArray())
});
}
dstDoc = new Document();
builder = new DocumentBuilder(dstDoc);
insertAfterNode = builder.CurrentParagraph;
}
}
}
return result;
}
Hi,
Hi Ashok,
…<o:p></o:p>
...
dstDoc = (Document)srcDoc.Clone();
dstDoc.RemoveAllChildren();
dstDoc.EnsureMinimum();
builder = new DocumentBuilder(dstDoc);
insertAfterNode = builder.CurrentParagraph;
}
}
}
}
}
}