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

Free Support Forum - aspose.com

How to set location for builder.StartTable()

Hi,

I am trying to show a Table in center of the page using
Aspose.Word (9.1.0.0) in word document. Can you please help me how to
set the location for a table.

Thanks & Regards,
Kalyan D

Hi Gautham,

Thanks for your inquiry. I suggest you please read following documentation link for your kind reference.
http://www.aspose.com/docs/display/wordsnet/DocumentBuilder+Overview
http://www.aspose.com/docs/display/wordsnet/Moving+the+Cursor

Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

Hi Tahir,

Thanks for your replay. Please find the attached sample file (sampleFile.docx) we need to generate report in this format.

Issue 2:-
Using Aspose.words Dll we need to generate the report in two formats word and PDF.
I am facing the issue is PDF generation. In word document header section is showing properly but in pdf, header information is not showing properly. please find the attached RPT1.doc and RPT1.pdf.

Please suggest me how to proceed.


Thanks,
Kalyan D.



Hi Kalyan,

Thanks for your inquiry.

gtheegala:

Please find the attached sample file (sampleFile.docx) we need to generate report in this format.

Please use Table.Alignment property to specify how an inline table is aligned in the document. Use Table.Alignment as TableAlignment.Center. Please check the highlighted code below.


Document
doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

Table table = builder.StartTable();

// Insert a cell

builder.InsertCell();

// Use fixed column widths.

table.AutoFit(AutoFitBehavior.FixedColumnWidths);

builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;

builder.Write("This is row 1 cell 1");

// Insert a cell

builder.InsertCell();

builder.Write("This is row 1 cell 2");

builder.EndRow();

// Insert a cell

builder.InsertCell();

// Apply new row formatting

builder.RowFormat.Height = 100;

builder.RowFormat.HeightRule = HeightRule.Exactly;

builder.CellFormat.Orientation = TextOrientation.Upward;

builder.Writeln("This is row 2 cell 1");

// Insert a cell

builder.InsertCell();

builder.CellFormat.Orientation = TextOrientation.Downward;

builder.Writeln("This is row 2 cell 2");

builder.EndRow();

builder.EndTable();

table.Alignment = TableAlignment.Center;

doc.Save(MyDir + "Out.docx");

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:DoNotShowPropertyChanges/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[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-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; 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-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

gtheegala:

Using Aspose.words Dll we need to generate the report in two formats word and PDF.
I am facing the issue is PDF generation. In word document header section is showing properly but in pdf, header information is not showing properly. please find the attached RPT1.doc and RPT1.pdf.

I have converted the shared document to Pdf and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10351. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Thanks for your replay.

Thanks,
Kalyan D.

Hi Tahir,

The PDF generation problem was resolved?

"I have converted the shared document to Pdf
and have managed to reproduce the same issue at my side. For the sake of
correction, I have logged this problem in our issue tracking system as
WORDSNET-10351. I have linked this forum thread to the same issue and
you will be notified via this forum thread once this issue is resolved."

Please let us know.

Thanks,
Kalyan D.

Hi Kalyan,

Thanks for your inquiry. I regret to share with you that your issue (WORDSNET-10351) has been postponed due to missing feature WORDSNET-832 (Make table layout as close to Word as possible) which is related to your issue.

After
the fix of WORDSNET-832, our development team will look into your
issue. I will be sure to inform you via this forum thread as soon as
this feature is available.

We apologize for your inconvenience.

@gtheegala,

Thanks for your patience. This issue has been resolved in latest version of Aspose.Words for .NET 18.4. Please use Aspose.Words for .NET 18.4.

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