wordpress hit counter
Welcome to OpenXML Developer Sign in | Join | Help

Section Break using VB.NET

Last post 06-11-2009, 12:27 PM by pleasehelp. 2 replies.
Sort Posts: Previous Next
  •  06-11-2009, 11:32 AM 5523

    Section Break using VB.NET

    I'd prefer to use C# and the generated code from document reflector shows this, but I need to do it in VB.net and can't figure it out. Can someone help me by converting this into VB please?

    var element =

    new SectionProperties(

    new PageSize(){ Width = (UInt32Value)15840U, Height = (UInt32Value)12240U, Orient = PageOrientationValues.Landscape },

    new PageMargin(){ Top = 1440, Right = (UInt32Value)1440U, Bottom = 1440, Left = (UInt32Value)1440U, Header = (UInt32Value)720U, Footer = (UInt32Value)720U, Gutter = (UInt32Value)0U },

    new Columns(){ Space = (UInt32Value)720U },

    new DocGrid(){ LinePitch = 360 }

    ){ RsidRPr = new HexBinaryValue() { Value = "00C6474E"}, RsidR = new HexBinaryValue() { Value = "000655B7"}, RsidSect = new HexBinaryValue() { Value = "000655B7"} };

    return element;

  •  06-11-2009, 11:55 AM 5524 in reply to 5523

    Re: Section Break using VB.NET

    Ok I figured out how to get it in there now just need to know how to set the properties for PageSize, PageMargin, Columns, DocGrid:

    Dim paragraph As New Paragraph()
    Dim run As New Run()
    Dim text As New Text("Dem chicken's jackin my style!")

    Dim s As SectionProperties = New SectionProperties(New PageSize(), New PageMargin(), New Columns(), New DocGrid())

    run.Append(text)
    paragraph.Append(run)
    body.Append(paragraph)
    body.Append(s)

     

    ***Heres the output**

     <w:p>
     <w:r>
      <w:t>Dem chicken's jackin my style!</w:t>
      </w:r>
      </w:p>
     <w:sectPr>
      <w:pgSz />
      <w:pgMar />
      <w:cols />
      <w:docGrid /> 
    </w:sectPr>
  •  06-11-2009, 12:27 PM 5527 in reply to 5524

    Re: Section Break using VB.NET

    Ah I figured it out, never mind.
View as RSS news feed in XML