We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Number bullets are in times new roman rather than the given font (arial)

Hi ,

We are processing the html file into word using the below code . We will split the pages using page break tag. A pages list will be passed and then we will write each page wise into document using aspose word.
If I am writing all over the html as a page( a string not a list of string) then the bullet font is arial. If i am writing as a page wise then the bullet numbers font is times new roman.

Ex: A html contains 17 pages, If i write full 17 pages data as a string into word then the font is fine . If i write each page wise data then the font is times new roman.

We are facing this font issue in our many clients.

For our reference : This is regarding defect 6789 .


Code we used currently :

string[] values = AsposeExtensions.SplitPageBreak(itemDto.Content);

var listPage = new List(values);
SaveDynamicDocument(listPage, strFilePath, strLeftHeader, strRightHeader);



public static string[] SplitPageBreak(String htmlData)
{
if (htmlData.Contains("<div style=“page-break-after: always;”><span style=“display: none”> 
"))
return htmlData.Split(new string[] { “<div style=“page-break-after: always;”><span style=“display: none”> 
" }, StringSplitOptions.RemoveEmptyEntries);
else if (htmlData.Contains(”<div style=“page-break-after: always”><span style=“display: none;”> 
“))
return htmlData.Split(new string[] { “<div style=“page-break-after: always”><span style=“display: none;”> 
" }, StringSplitOptions.RemoveEmptyEntries);
else if (htmlData.Contains(”<div style=“page-break-after: always;”><span style=“display: none;”> 
“))
return htmlData.Split(new string[] { “<div style=“page-break-after: always;”><span style=“display: none;”> 
" }, StringSplitOptions.RemoveEmptyEntries);
else
return htmlData.Split(new string[] { “<div style=“page-break-after: always”><span style=“display: none”> 
" }, StringSplitOptions.RemoveEmptyEntries);
}




public void SaveDynamicDocument(List listPage, string filePath, string strLeftHeader, string strRightHeader)
{
var doc = new Document();
var builder = new DocumentBuilder(doc);

doc.Sections.Clear();

var newSec = new Aspose.Words.Section(doc);
newSec.ProtectedForForms = true;

newSec.PageSetup.SectionStart = SectionStart.Continuous;

for (int i = 0; i < listPage.Count; i++)
{
var listSection = new List() { listPage[i] };

CreateDocSections(listSection, doc, builder, i);
}

doc.Save(filePath);
}

private void CreateDocSections(List listSection, Document doc, DocumentBuilder builder, int pageIndex)
{
for (var i = 0; i < listSection.Count; i++)
{
var newSec = new Aspose.Words.Section(doc);

if (pageIndex == 0)
newSec.PageSetup.SectionStart = SectionStart.Continuous;
else
{
if (i == 0)
newSec.PageSetup.SectionStart = SectionStart.NewPage;
else
newSec.PageSetup.SectionStart = SectionStart.Continuous;
}

doc.Sections.Add(newSec);
builder.MoveToSection(_countSectionIndex);

FontSettings.DefaultInstance.DefaultFontName = “Arial Unicode MS”;

_countSectionIndex += 1;
if (listSection[i].Contains(”<input name=“hdnLandscape” type=“hidden” value=“MakeLandscape” />”))
{
newSec.PageSetup.Orientation = Orientation.Landscape;
builder.InsertHtml(listSection[i].Replace(”<input name=“hdnLandscape” type=“hidden” value=“MakeLandscape” />”, “”));
}
else
{
newSec.PageSetup.Orientation = Orientation.Portrait;
builder.InsertHtml(listSection[i]);
}
}
}




Hi Rajesh,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input HTML.
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a standalone console application (source code without compilation errors) that calls the shared methods and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.