Preserve Text Alignment in Table Cell during Word DOT to HTML Conversion using C# .NET

Dear Hafeez

I am really happy with the response for my doubts and also the conversion happening from word to HTML file.

I am facing issue with the conversion with one sample document(MS word DOT file to HTML file)

I am uploading all files DOT file, Converted HTML and also code file.

Please check and let me know why there is miss alignment only at the marked area in the image.

Thanks and regards
ManjunathSample_To_Check.zip (17.1 KB)

with regards
Manjunath

@manjunath.patil,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-21264. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Dear Hafeez

Thanks for the reply.
I have one more issue with extracting header from DOT files.
Example I have two samples Sample1 and Sample 2. Both has only one page and also has header on first page. I am trying to extract Headers with the attached code.
Problem here is
When I extract HeaderFooterType.HeaderFirst then I get header only for sample2 but not for Sample1.
When I extract HeaderFooterType.HeaderPrimary then I get header only for sample1 but not for Sample2.

Why both files are interpreted differently? My intention is to extract header from first page for al my documents.Header Sample.zip (22.2 KB)

with regards
Manjunath

@manjunath.patil,

Please note that there can be a maximum of only one HeaderFooter of each HeaderFooterType per Section. Talking about Headers, they are of three types i.e. HeaderFirst, HeaderPrimary and HeaderEven; so up to three different Headers are possible in a Section (i.e. for first, even and odd pages).

HeaderFirst in Sample1.dot is empty and its PageSetup.DifferentFirstPageHeaderFooter is disabled, so that means we need to extract HeaderPrimary content. Secondly, HeaderPrimary of Sample2.dot is empty and its PageSetup.DifferentFirstPageHeaderFooter is enabled, that means we need to extract HeaderFirst content.

Please try to build logic on the following code:

Document doc = new Document("C:\\temp\\Header Sample\\Sample2.dot");

Section targetSection = doc.FirstSection;
HeaderFooter targetHeader = null;
if (targetSection.PageSetup.DifferentFirstPageHeaderFooter)
    targetHeader = targetSection.HeadersFooters[HeaderFooterType.HeaderFirst];
else
    targetHeader = targetSection.HeadersFooters[HeaderFooterType.HeaderPrimary];

// process targetHeader object

Thanks for the response but how to check HeaderPrimary is empty or HeaderFirst is empty?

@manjunath.patil,

You can determine if any header or footer is empty by using the following code:

Section targetSection = doc.FirstSection;
HeaderFooter targetHeader = targetSection.HeadersFooters[HeaderFooterType.HeaderFirst];
if (targetHeader.ChildNodes.Count > 0 || !string.IsNullOrEmpty(targetHeader.ToString(SaveFormat.Text).Trim()))
{
    // not empty
}

@manjunath.patil,

Regarding WORDSNET-21264, we suggest you to please remove hidden spaces after the word “Place”. Its spaces are clipped by Table Border, but they become visible if you switch on “Show/Hide formatting symbols”.

Hi

Yes for Place its resolved how about ID? alignment?

@manjunath.patil,

To address this problem, we have logged a separate issue in our issue tracking system with ID WORDSNET-21282. We will further look into the details of this problem and will keep you updated on the status of this issue. We apologize for your inconvenience.

A post was split to a new topic: Retain Table Column Widths during Word DOT Document to HTML Conversion using C# .NET

@manjunath.patil,

Regarding WORDSNET-21282, we suggest you to please remove one space before “ID” word. It is a workaround. Width of spans before and after “ID” word currently calculated by Aspose.Words incorrectly. We will keep you posted here on any further updates.

The issues you have found earlier (filed as WORDSNET-21282) have been fixed in this Aspose.Words for .NET 21.1 update and this Aspose.Words for Java 21.1 update.