Hi Alexy,
Thanks for your reply.
Can you please let me know on which version of Aspose you have verified this?
Regards,
Dwarika
Hi Alexy,
Thanks for your reply.
Can you please let me know on which version of Aspose you have verified this?
Regards,
Dwarika
Hi Dwarika,
Thanks for your request. We always use the latest version of Aspose.Words for testing. You can download the latest version from here:
https://releases.aspose.com/words/net
Best regards,
Hello Alexey,
We have upgraded Aspose.Words from 9.0 to 9.5 and verified the bullet point issue with new version.
Still we feel this issue is not resolved.
Attcahed is the output renderred using Aspose.Words 9.5.
Space between the bullet and the text appears to be different with different left indent setting.
Regards,
Dwarika
Hi Dwarika,
Thanks for your request. As I already mentioned I cannot reproduce the problem on my side. I also attached my output document in my previous answer. As you also can see the output document produced on my side looks correct. So, please provide me full code that will allow me to reproduce the problem out output and expected output documents.
Best regards,
Hello Alexey,
Here is the sample code that I am using to test HTML bullets.
We are facing problem with in-consistent space between bullet and text when left margin is set with different values.
string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
// Initialize Aspose license. Aspose Word version 9.5.0.0
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(path + @"\Aspose.Total.lic");
Aspose.Pdf.License lic1 = new Aspose.Pdf.License();
lic1.SetLicense(path + @"\Aspose.Total.lic");
Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
Run run;
Aspose.Words.Font font;
double leftMargin = 0;
// set the page set-up
PageSetup pageSetup = documentBuilder.CurrentSection.PageSetup;
pageSetup.PaperSize = PaperSize.A4; //set the page size.
pageSetup.LeftMargin = leftMargin;
documentBuilder.ParagraphFormat.ClearFormatting();
// set font
run = new Run(doc);
font = run.Font;
documentBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
font.Name = "Arial Unicode MS";
font.Size = 11;
font.Italic = false;
string strBullet = "Paragraph for bullet points:<li>First bullet point</li><li>Second bullet point</li><li>Third bullet point</li><li>Forth bullet point</li>";
Paragraph currNode = documentBuilder.CurrentParagraph;
documentBuilder.InsertHtml("Document to test bullets in a paragraph");
documentBuilder.InsertBreak(BreakType.LineBreak);
documentBuilder.InsertHtml("Left Margin Set for page is: " + leftMargin.ToString());
documentBuilder.InsertBreak(BreakType.LineBreak);
documentBuilder.InsertHtml("Paragraph for bullet points:");
documentBuilder.InsertHtml(strBullet);
do
{
if (currNode.NodeType == NodeType.Paragraph)
{
Paragraph currentParagraph = (Paragraph)currNode;
currNode.ParagraphFormat.LeftIndent = leftMargin;
if (currNode.IsListItem)
{
currNode.ListFormat.ListLevel.NumberPosition = leftMargin;
currNode.ListFormat.ListLevel.TextPosition = leftMargin;
currNode.ListFormat.ListLevel.TabPosition = leftMargin;
}
// move to next node
currNode = (Paragraph)currNode.NextSibling;
}
} while (currNode != null && !currNode.Equals(documentBuilder.CurrentParagraph));
// Loop through all paragraphs and reset auto spacing.
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph paragraph in paragraphs)
{
paragraph.ParagraphFormat.SpaceAfterAuto = false;
paragraph.ParagraphFormat.SpaceAfter = 0;
}
documentBuilder.InsertHtml("Text after bullet points");
doc.Save("HTML_Bullets_06Jan2011(LeftMargin=0).doc");
StartWord("HTML_Bullets_06Jan2011(LeftMargin=0).doc");
Also refer to following attachments,
Also take a look at Difference Between Bullet and Text.doc inside this folder for comparison between various margins and space between bullet and text.
Also take a look at Difference Between Bullet and Text.doc inside this folder for comparison between various margins and space between bullet and text.
Regards,
Dwarika
Hi Dwarika,
Thanks for your request. The problem occurs because you set tab position the same as number position. That is why default tab stop is used and you do not get the expected result. Please see the following modified code:
do
{
if (currNode.NodeType == NodeType.Paragraph)
{
Paragraph currentParagraph = (Paragraph)currNode;
currNode.ParagraphFormat.LeftIndent = leftMargin;
if (currNode.IsListItem)
{
currNode.ListFormat.ListLevel.NumberPosition = leftMargin;
currNode.ListFormat.ListLevel.TextPosition = leftMargin;
// Tab position should not be less or equel number position.
// If they are equel default tab stop will be used and you will not get the expected tab position.
// That is why you should increase tab position. In this case distance from bult to text will be expected.
currNode.ListFormat.ListLevel.TabPosition = leftMargin + 20;
}
// move to next node
currNode = (Paragraph)currNode.NextSibling;
}
} while (currNode != null && !currNode.Equals(documentBuilder.CurrentParagraph));
Also, please see my comments in the code. Hope this helps.
Best regards,
Hello Alexey,
Thanks for your reply and suggestion. I tried by increasing TabPosition as you have stated and it worked for me.
Still I have one query, do we have to default TabPosition = margin + 20?
As I have also tested using 10 and in the output the space between bullet point and text was reduced.
So increasing TabPosition by some number adjust the space between the bullet and the text.
Please confirm.
Regards,
Dwarika
Hi Dwarika,
Thanks for your request. Yes, you are right changing TabPosition will change distance between bullet and text.
Best regards,
Hello Alexey,
Thanks for your quick reply and valuable support. I managed to get this in correct manner as far as LRT languages are concerned. However when I tried same code by doing changes that will fir RTL languages for margins 25 onwards the bullet points are not aligned with the text before them. Below is the sample code for RTL test.
string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
// Initialize Aspose license. Aspose Word version 9.5.0.0
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(path + @"\Aspose.Total.lic");
Aspose.Pdf.License lic1 = new Aspose.Pdf.License();
lic1.SetLicense(path + @"\Aspose.Total.lic");
Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
Run run;
Aspose.Words.Font font;
double leftMargin = 0;
double rightMargin = 50;
double increasedTabPosition = 20;
// set the page set-up
PageSetup pageSetup = documentBuilder.CurrentSection.PageSetup;
pageSetup.PaperSize = PaperSize.A4; //set the page size.
pageSetup.LeftMargin = leftMargin;
pageSetup.RightMargin = rightMargin;
documentBuilder.ParagraphFormat.ClearFormatting();
// set font
run = new Run(doc);
font = run.Font;
documentBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
font.Name = "Arial Unicode MS";
font.Size = 11;
font.Italic = false;
// string strBullet = "Paragraph for bullet points:<li>First bullet point</li><li>Second bullet point</li><li>Third bullet point</li><li>Forth bullet point</li>";
string strBullet = "فقرة عن النقاط :<li>أول رصاصة نقطة</li><li>الرصاصة الثانية نقطة</li><li>ثالث رصاصة نقطة</li><li>عليها رصاصة نقطة</li>";
Paragraph currNode = documentBuilder.CurrentParagraph;
// documentBuilder.InsertHtml("Document to test bullets in a paragraph");
documentBuilder.InsertHtml("وثيقة لاختبار الرصاص في فقرة");
documentBuilder.InsertBreak(BreakType.LineBreak);
// documentBuilder.InsertHtml("
Left Margin Set for page is: " + leftMargin.ToString() + " Tab Position Increased by: " + increasedTabPosition.ToString() + "");
documentBuilder.InsertHtml("تعيين الهامش الأيسر للصفحة هو : "
+ rightMargin.ToString() + " زيادة تبويب المركز من قبل : " + increasedTabPosition.ToString() + "");
documentBuilder.InsertBreak(BreakType.LineBreak);
// documentBuilder.InsertHtml("Paragraph for bullet points:");
documentBuilder.InsertHtml("فقرة عن النقاط :");
documentBuilder.InsertHtml(strBullet);
do
{
if (currNode.NodeType == NodeType.Paragraph)
{
Paragraph currentParagraph = (Paragraph)currNode;
currNode.ParagraphFormat.RightIndent = rightMargin;
if (currNode.IsListItem)
{
currNode.ListFormat.ListLevel.NumberPosition = rightMargin;
currNode.ListFormat.ListLevel.TextPosition = rightMargin;
currNode.ListFormat.ListLevel.TabPosition = rightMargin + increasedTabPosition;
}
// move to next node
currNode = (Paragraph)currNode.NextSibling;
}
} while (currNode != null && !currNode.Equals(documentBuilder.CurrentParagraph));
// Loop through all paragraphs and reset auto spacing.
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph paragraph in paragraphs)
{
paragraph.ParagraphFormat.SpaceAfterAuto = false;
paragraph.ParagraphFormat.SpaceAfter = 0;
}
documentBuilder.InsertBreak(BreakType.LineBreak);
documentBuilder.ParagraphFormat.RightIndent = rightMargin;
// documentBuilder.InsertHtml("Text after bullet points");
documentBuilder.InsertHtml("النص بعد النقاط");
doc.Save("HTML_Bullets_07Jan2011(RightMargin=0).doc");
StartWord("HTML_Bullets_07Jan2011(RightMargin=0).doc");
Also take a look at RTL sample documents for different margin settings.
Regards,
Dwarika
Hi Dwarika,
Thanks for your request. The following code should give you the expected result:
do
{
if (currNode.NodeType == NodeType.Paragraph)
{
currNode.ParagraphFormat.LeftIndent = leftMargin;
if (currNode.IsListItem)
{
currNode.ListFormat.ListLevel.NumberPosition = leftMargin;
currNode.ListFormat.ListLevel.TextPosition = leftMargin;
currNode.ListFormat.ListLevel.TabPosition = leftMargin + increasedTabPosition;
}
// move to next node
currNode = (Paragraph)currNode.NextSibling;
}
} while (currNode != null && !currNode.Equals(documentBuilder.CurrentParagraph));
Best regards,
The issues you have found earlier (filed as WORDSNET-2104) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)