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

Free Support Forum - aspose.com

Problem while saving word document that contains tables

Hi all
When i save my word document which contains table it changes borders to custom format (it puts diagonal lines) i couldn’t solve or find any posts related to this problem so please help me to solve out this
thanks

Hi

Thanks for your request. Could you please attach your document for testing and provide me code that will allow me to reproduce the problem? I will investigate the issue and provide you more information.

Best regards.

I found where problem is but i can’t solve it

1)

Document wdoc=new Document(@"C:\abc.doc");
DocumentRender dr=new DocumentRender(wdoc);
wdoc.Save("C:\ddd.doc");
PageNavigator pn=new PageNavigator(dr);
Bitmap img=pn.CurrentPage;

2)

Document wdoc=new Document(@"C:\abc.doc");
DocumentRender dr=new DocumentRender(wdoc);
wdoc.Save("C:\ddd.doc");
PageNavigator pn=new PageNavigator(dr);
Bitmap img=pn.CurrentPage;
wdoc.Save("C:\ddd.doc");

1’st one works fine it doesn’t change source formatting for tables because i saved document before PageNavigator line but 2’nd one changes table setting to custom so i have proble with PageNavigator
to make it work i define two documents and load same document one for saving and other one for viewing
plz can you help me to fix this problem

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Aspose.Words.Viewer;
using Aspose.Words;

namespace QuesGen
{
    public partial class QCreate : DevExpress.XtraEditors.XtraForm
    {
        private Document wDoc;
        private PageNavigator wPN;
        private OpenFileDialog ofd;

        public QCreate()
        {
            InitializeComponent();
        }

        void btprevious_Click(object sender, EventArgs e)
        {
            try
            {
                wPN.MoveToPreviousPage();
                UpdateQ();
            }
            catch (Exception t)
            {
            }
        }
        void btnextpage_Click(object sender, EventArgs e)
        {
            try
            {
                wPN.MoveToNextPage();
                UpdateQ();
            }
            catch (Exception t)
            {
            }
        }

        void newDocumentButton_Click(object sender, EventArgs e)
        {
            ofd = new OpenFileDialog();
            if (ofd.ShowDialog().Equals(DialogResult.OK))
            {
                wDoc = new Document(ofd.FileName);
                DocumentRenderer dr = new DocumentRenderer(wDoc);
                dr.PageBounds = PageBounds.Border;
                wPN = new PageNavigator(dr);
                UpdateQ();
            }
        }
        void saveButton_Click(object sender, EventArgs e)
        {
            wDoc.Save(@"" + expath + "/DATA/QUESTION/QN" + fn + ".doc");
        }

        private void UpdateQ()
        {
            bool f = !wPN.IsFirstPage;
            btprevious.Enabled = f;
            f = !wPN.IsLastPage;
            btnextpage.Enabled = f;

            Bitmap page = wPN.CurrentPage;
            pictureBox1.Width = SystemInformation.WorkingArea.Width - SystemInformation.VerticalScrollBarWidth;
            pictureBox1.Height = page.Height + 100;
            pictureBox1.Image = page;
        }
    }
}

this is my complete code

Hi

Thank you for additional information. As I can see you are using old version of Aspose.Words.

Starting from Aspose.Words 6.0.0 the new Rendering Engine has replaced the “old Viewer Beta”.

So please try using the latest version of Aspose.Words. You can download it from here:

Best regards.

ok thank you very much i’ll try that one
spasibo bolshoe

Hi Alexey
I download aspose word 6.0 version but there is not Aspose.Words.Preview class and my old preview methods using picturebox not working so can you help me how to preview word document with new version
thanks

Hi

Thanks for your request. Please see Aspose.Words documentation to learn more about new features.

SaveToImage method renders document pages into images:

Best regards.