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

Free Support Forum - aspose.com

Document format issue :

Dear Team ,


I am using Aspose.words.java latest version for document conversion .I have attached a sample document from which i am parsing each paragraph to get its Space After and Before properties . For 1st two paragraphs i am getting exact value as defined, but from 3 rd paragraph i am getting the space after and before value is 0pt .
Code :
ParagraphFormat para = paragraph.getParagraphFormat( );
System.out.println(“SP BEFORE::::::::::::”+para.getSpaceBefore( ));
System.out.println(“SP AFTER ::::::::::::”+para.getSpaceAfter( ));

Please do the needful help

Regards,
Anbu
<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0pt 5.4pt 0pt 5.4pt; mso-para-margin:0pt; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:SimSun; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi

Thanks for your request. It seems in your case these properties are defined via Theme in DOCX document. Unfortunately, Aspose.Words does not allow getting properties defined in Theme. However, you can easily work this problem around by converting your document to DOC format. DOC format does not supports Themes so all properties defined via Themes are converted to the appropriate attributes of Paragraphs and runs. Please see the following code:

Document doc = new Document(@"Test001\All-headings.docx");

// Save document as DOC and open it again.

using (MemoryStream ms = new MemoryStream())

{

doc.Save(ms, SaveFormat.Doc);

ms.Position = 0;

doc = new Document(ms);

}

foreach (Paragraph paragraph in doc.FirstSection.Body.Paragraphs)

{

Console.WriteLine(paragraph.ParagraphFormat.Style.ParagraphFormat.SpaceAfter);

}

Hope this helps.

Best regards,

I have attached a doc containing drop cap . During iterating all paragraph i am getting line space 41.35pt for drop cap. Is it possible to remove drop cap or identify drop cap ?


Thanks,
Anbu

Hello

Thanks for your inquiry. Yes of course you can do it. In this case you can try using ParagraphFormat.DropCapPosition property of Paragraph.

Document doc = new Document("C:\\Temp\\drop_cap.doc");

foreach (Paragraph paragraph in doc.FirstSection.Body.Paragraphs)

{

if (paragraph.ParagraphFormat.DropCapPosition != DropCapPosition.None)

paragraph.Remove();

}

doc.Save("C:\\Temp\\out.doc");

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.dropcapposition.html

Please let me know in case of any issues, I will be glad to help you.

Best regards,

Thanks for the reply . I have attached another document with this in which it has paragraph with background shading . Through ParagrapFormat.getShading().getTexture() i can able to get the type of the shading but not the color . Is it possible to get color code ?


Regards,
Anbu.S

Hello

Thanks for your inquiry. Have you tried using the following code?

getParagraphFormat().getShading().getBackgroundPatternColor();

getParagraphFormat().getShading().getForegroundPatternColor();

Hope this helps.

Best regards,

Yes i have tried that, i am getting rgb(0,0,0) for that paragraph but the actual color is grey rgb(0,0,225) . I have attached doc with this .

Hi

Thank you for additional information. Actually, Aspose.Words returns correct values of colors. In this case, empty color means Auto Color in MS Word. Please see the attached screenshot.

Best regards,

Thanks for your reply . Yes i understood that, but after converting DOC into HTML using aspose, i am getting exact color grey. Is Aspose using any other method to get that color ?

Hi

Thanks for your request. Aspose.Words simply calculates the auto color itself.

Best regards,

The issues you have found earlier (filed as WORDSNET-3312) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.