Tahir,
We are using the doc tag to insert the sub document. The issue we are running into is that if I indent the <> tag three times in the master document, when the sub-document is inserted it looses those indents.
Attached is a sample project.
I am trying to work around some of the limitations we have found with the Linq template language. Namely, if there are
tags in HTML, and you insert them into a list, then it will create new list items. And trying to re-order a numbered list.
The use case that we have is a user is able to enter data into a website using a rich text box.
This information will eventually make its way into a report, generated using Aspose.
In the report, we want to number the items they have added.
So think of a candy manufacturing plant, where they sample pieces of candy coming off the line, and making comments on a website for quality control.
The user would go to the website and list out the following:
Candy: Lolipop
Sample 1: Tasted really good
Sample 2: Color was bright and vibrant
Sample 3:
John added to much sugar.
Not sure why John added that much sugar, need to do the following three things:
- Check the amount of sugar there should have been
- Check the amount John added
- Write up John
When we go to actually generate the document, we want to show what was entered above like this:
Sample Type:
Lolipop (3 Samples)
Samples:
- Tasted really good
- Color was bright and vibrant
- John added to much sugar.
Not sure why John added that much sugar, need to do the following three things:
- Check the amount of sugar there should have been
- Check the amount John added
- Write up John
But with the Template language, it comes out like this:
Sample Type:
Lolipop (3 Samples)
Samples:
- Tasted really good
- Color was bright and vibrant
- John added to much sugar.
- Not sure why John added that much sugar, need to do the following three things:
a. Check the amount of sugar there should have been
b. Check the amount John added
c. Write up John
You will notice that we told the user there were 3 samples, but there are 4 line items because when we inserted HTML, it saw the
tag on the third sample and created a new item.
It actually gets a little trickier because with the Rich Text control we are using (quill), it adds a
tag to every line, so we end up with like 8 different lines. We can strip some of the characters, but in some cases having the paragraph tag is valid.
We also run into the problem mentioned before that when we start on the next list, it doesn’t start numbering at 1, it keeps the numbering going.
So I thought I could work on an extension method to pass in the arguments I want on the list, have it create the list in a blank document, then insert it where needed.
So far, this is actually going pretty well. I can have it restart the numbering on the list, and I have found a way to indent the HTML so it doesn’t create a new line item.
However, I loose things like tabs in the source document.
I.E. if my tag looks like this, with three tabs to the left:
<<doc [ListHelper.InsertList()]>>
When I look at the generated document, that list is no longer indented three times.
Also, it would be cool if I could pass into that extension method the Document it is being inserted into, so that I can work with the document itself, rather than appending a new one.
Hope this makes sense. You should be able to see what I am attempting in the attached sample.
Also, you may be asking why we are using a numbered list rather than a table, or some other method where we can use NumberOf to write out the sample number. The user may be editing this document after it is generated, and it is easier for them to continue a numbered list, as opposed to inserting a table row within word.
Aspose Samples.zip (379.5 KB)