Issue with list symbol

DocFramework Technical Support

Issue with list symbol

Postby nguyenthai on Mon Jan 04, 2010 7:34 am

I have inserted from a word file document into another one. But after inserting, list symbols couldn't keep original format
See attachment:
list.JPG
list symbol
list.JPG (37.99 KB) Viewed 143 times

My code here:
public void InsertDocument(int position, string sourcefile,string destfile)
{
this.pos = position;
Document sourcedoc = new Document();
List list = new List();
list.ListFormat = ListFormat.GetMultiLevelBulletListFormat("");
sourcedoc.Load(DocFormat.Instance, sourcefile.Substring(0, sourcefile.Length - 4));
Document destdoc = new Document();
destdoc.Load(DocFormat.Instance, destfile.Substring(0, destfile.Length - 4));
for (int c = 0; c < sourcedoc.Elements.Count; c++)
{
TravelElement(sourcedoc.Elements[c], ref destdoc);
}
destdoc.Save(DocFormat.Instance, destfile);
}
private void TravelElement(TextElement element, ref Document outputDoc)
{

switch (element.ElementType)
{
case TextElementType.List:
List list = (List)element;
outputDoc.InsertList(pos,list);
pos += list.Text.Length;
break;
case TextElementType.ListLevel:
break;
case TextElementType.Paragraph:
Paragraph para = (Paragraph)element;
outputDoc.InsertParagraphCopy(pos,para);
pos += para.Text.Length;
break;
case TextElementType.Section:
Section section = (Section)element;
List<Object> paraList = new List<Object>();
foreach (Object p in section.Elements)
{
paraList.Add(p);
}
for (int i = 0; i < paraList.Count; i++)
{
TravelElement((TextElement)paraList[i], ref outputDoc);
}
break;
case TextElementType.Table:
Table table = (Table)element;
outputDoc.InsertTable(pos,table);
pos += table.Text.Length;
break;
default:
break;
}
}
nguyenthai
 
Posts: 2
Joined: Mon Jan 04, 2010 6:55 am

Re: Issue with list symbol

Postby Cellbi on Mon Jan 04, 2010 10:30 pm

Thanks for the sample code provided, can you also post the document where this problem happens.
Thanks in advance.
Thanks,
Tech Support
Cellbi Software
Cellbi
Support
 
Posts: 70
Joined: Sat Mar 15, 2008 8:41 am
Location: Cellbi Software

Re: Issue with list symbol

Postby nguyenthai on Tue Jan 05, 2010 2:07 am

http://rapidshare.com/files/330471877/s ... e.doc.html
http://rapidshare.com/files/330472117/destfile.doc.html
Here is the document files that I used in my source code. In addition, I have a mistake in my souce code. The InsertDocument method should delete 2 line
Code: Select all
List list = new List();
list.ListFormat = ListFormat.GetMultiLevelBulletListFormat("");
So It should be
Code: Select all
public void InsertDocument(int position, string sourcefile,string destfile)
{
            this.pos = position;
            Document sourcedoc = new Document();
            //List list = new List();
            //list.ListFormat = ListFormat.GetMultiLevelBulletListFormat("");
            sourcedoc.Load(DocFormat.Instance, sourcefile.Substring(0, sourcefile.Length - 4));
            Document destdoc = new Document();
            destdoc.Load(DocFormat.Instance, destfile.Substring(0, destfile.Length - 4));
            for (int c = 0; c < sourcedoc.Elements.Count; c++)
            {
                TravelElement(sourcedoc.Elements[c], ref destdoc);
            }
            destdoc.Save(DocFormat.Instance, destfile);
}
nguyenthai
 
Posts: 2
Joined: Mon Jan 04, 2010 6:55 am


Return to DocFramework

Who is online

Users browsing this forum: No registered users and 1 guest

cron