Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am generating document using Office XML ans upload it to Sharepoint. The document which i have generating is rendered perfectly in MS Word. I have also used paragraph styling and table styling classes.

Office Look

But when i upload it to sharepoint document library and open it in web apps then alignment of that document seems like this.

Web apps Look

I have done code as below to create tabular content.

Dim tr As TableRow = Nothing
Dim tcKey As TableCell = Nothing
Dim tcValue As TableCell = Nothing

Try
    Dim tblprop1 As TableProperties = New TableProperties
    Dim tblBorders As TableBorders = New TableBorders

    tblBorders.TopBorder = New TopBorder() With {.Val = New EnumValue(Of BorderValues)(BorderValues.Single), .Size = 10}
    tblBorders.BottomBorder = New BottomBorder() With {.Val = New EnumValue(Of BorderValues)(BorderValues.Single), .Size = 10}
    tblBorders.LeftBorder = New LeftBorder() With {.Val = New EnumValue(Of BorderValues)(BorderValues.Single), .Size = 10}
    tblBorders.RightBorder = New RightBorder() With {.Val = New EnumValue(Of BorderValues)(BorderValues.Single), .Size = 10}
    tblBorders.InsideHorizontalBorder = New InsideHorizontalBorder() With {.Val = New EnumValue(Of BorderValues)(BorderValues.Single), .Size = 10}
    tblBorders.InsideVerticalBorder = New InsideVerticalBorder() With {.Val = New EnumValue(Of BorderValues)(BorderValues.Single), .Size = 10}

    tblprop1.Append(tblBorders)
    table1.Append(tblprop1)

    tr = New TableRow
    tcKey = New TableCell
    tcValue = New TableCell

    tcKey.Append(New TableCellProperties(New TableCellWidth() With {.Type = TableWidthUnitValues.Dxa, .Width = "19000"}))
    tcKey.Append(New Paragraph(New Run(New Text("No.: 1918/01/12"))))

    tcValue.Append(New TableCellProperties(New TableCellWidth() With {.Type = TableWidthUnitValues.Dxa, .Width = "5000"}))
    tcValue.Append(New Paragraph(New Run(New Text("Date: 27-Aug-2012"))))

    tr.Append(tcKey)
    tr.Append(tcValue)

    table1.Append(tr)

    Return True
Catch ex As Exception
    lblError.Text = ex.Message
    Return False
End Try

After this code i have append this table object to body.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.