Hello,
I have a file that’s opening incorrectly (the table view isn’t displaying correctly).
I checked the latest version of aspose-java, and the error still persists. I checked your online viewer (Word, PDF Viewer Online), and it also displays the error incorrectly.
p.s. Also It do not set grey background of some fields (example for text “01.01.2020”). I attached problem file and image with correct view.
example.zip (43.9 KB)
Thanks,
Evgeny.
@aleksand Which format are you converting the document to for viewing? I tried rendering the document to various fixed-page formats, such as PDF, XPS and images, and it was rendered correctly.
If possible, could you please attach the problematic output document generated on your side?
The fields actually do not have gray background. MS Word highlight all formfields with gray background. This is by default.
You can disable this option in MS Word.
- Right click on MS Word toolbar and select from the context menu “Form”.
- On this toolbar click “Form Field Shading”
This option is not stored in the document so you can not set it programmatically using Aspose.Words.
Blockquote The fields actually do not have gray background. MS Word highlight all formfields with gray background. This is by default. You can disable this option in MS Word.
Ok. Thank you very much for the clarification!
@aleksand Thank you for additional information. But the questions remains the same. Which format are you converting the document to for viewing?
I use jpeg (but your online viewer has the same result). I use following code:
ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.JPEG);
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
imageOptions.setResolution(300.f);
imageOptions.setUseHighQualityRendering(true);
imageOptions.setUseAntiAliasing(true);
GraphicsQualityOptions qualityOptions = new GraphicsQualityOptions();
qualityOptions.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // SmoothingMode
qualityOptions.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // TextRenderingHint
qualityOptions.getRenderingHints().put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); // CompositingMode
qualityOptions.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // CompositingQuality
qualityOptions.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); // InterpolationMode
qualityOptions.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); // StringFormat
imageOptions.setGraphicsQualityOptions(qualityOptions);
imageOptions.setPageSet(new PageSet(getPageNumber()-1));
docApsose.save(imageStream, imageOptions);
@aleksand
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-29255
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@aleksand We have completed analyzing the issue. The issue occurs because Aspose.Words does not imitate MS Word logic when handling paragraph breaks inside field codes. As a workaround, you can simply disable updating fields upon rendering the document:
ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.JPEG);
imageOptions.setUpdateFields(false);
Hi,
Thanks, but it’s working really strangely. After these changes, the first render frame displays correctly, but if a second (and all other) render occurs, the image displays incorrectly again. It use the same method for draw page.
Thanks,
Evgeny.
@aleksand Yes, we also observed this behavior. The only way we managed to reproduce your problematic output on our side is rendering the document the second time. To get consistent output, field updating should be disabled in all document rendering operations.
Thanks! Now (after set these to all draw methods) it is working.
@aleksand It is perfect that you managed to resolve the problem. Please feel free to ask in case of any issues. We are always glad to help you.