ColumnHeader wordwrap

Posted by: rick-macdonald on 8 September 2017, 1:57 pm EST

  • Posted 8 September 2017, 1:57 pm EST

    <FONT size=2>

    </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>I am using Spread for Windows Forms 4.0.2010.2005 with VS2005 visual basic </FONT></FONT>


    <FONT color=#008000 size=2><FONT color=#008000 size=2>ColumnHeaderLabel text has been set to '<FONT color=#800000 size=2><FONT color=#800000 size=2>FFT Power Spectra (PV=in/s)' </FONT></FONT></FONT></FONT>


    <FONT color=#008000 size=2><FONT color=#008000 size=2>the text always wraps the between  </FONT></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>'FFT Power Spectra' and '(PV=in/s)' when printed</FONT></FONT>


    <FONT color=#008000 size=2><FONT color=#008000 size=2>but not on screen display.  On the printout the bottom half of  'FFT Power Spectra'  is visible</FONT></FONT>


    <FONT color=#008000 size=2><FONT color=#008000 size=2>and the upper half of '(PV=in/s)' is visible like there is multiple lines of text behind a single line viewing area  </FONT></FONT>


    <FONT color=#008000 size=2><FONT color=#008000 size=2>I have tried other text with different but still unexpected results </FONT></FONT>


    <FONT color=#008000 size=2><FONT color=#008000 size=2>Thanks for your help

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> nCols </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Integer

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> nRows </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Integer

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> tmpTitle </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>String

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> tmpSubTitle </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>String

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> tmpUnit1 </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>String

    </FONT></FONT><FONT size=2>

    nCols = 4


    nRows = 10


    tmpTitle = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"FFT Power Spectra (PV=in/s)"

    </FONT></FONT><FONT size=2>

    tmpSubTitle = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"SN: 3000 Event: 8"

    </FONT></FONT><FONT size=2>

    tmpUnit1 = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"PV^2/Hz"

    </FONT></FONT><FONT size=2>

    FpSpread1.Reset()


    FpSpread1.ActiveSheet.SetRowHeight(-1, 16) </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>'Default=20 pixels

    </FONT></FONT><FONT size=2>

    FpSpread1.ActiveSheet.Rows(-1).Resizable = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>False

    </FONT></FONT><FONT size=2>

    FpSpread1.AutoClipboard = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>True

    </FONT></FONT><FONT size=2>

    FpSpread1.AllowDragDrop = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>True

    </FONT></FONT><FONT size=2>

    FpSpread1.ScrollBarTrackPolicy = FarPoint.Win.Spread.ScrollBarTrackPolicy.Both


    FpSpread1.ActiveSheet.OperationMode = FarPoint.Win.Spread.OperationMode.Normal


    FpSpread1.ActiveSheet.ColumnCount = nCols


    FpSpread1.ActiveSheet.RowCount = nRows


    FpSpread1.ActiveSheet.ColumnHeaderVisible = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>True

    </FONT></FONT><FONT size=2>

    FpSpread1.ActiveSheet.ColumnHeaderRowCount = 3


    FpSpread1.ActiveSheet.ColumnHeader.Rows(0).Height = 32


    FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(0, 0, 1, nCols)


    FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 0, 1, nCols)


    FpSpread1.ActiveSheet.SetColumnLabel(0, 0, tmpTitle)


    FpSpread1.ActiveSheet.SetColumnLabel(1, 0, tmpSubTitle)


    FpSpread1.ActiveSheet.ColumnHeader.Columns(0).Label = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"(Hz)"

    </FONT></FONT><FONT size=2>

    FpSpread1.ActiveSheet.ColumnHeader.Columns(1).Label = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"L (PV^2/Hz)"

    </FONT></FONT><FONT size=2>

    FpSpread1.ActiveSheet.ColumnHeader.Columns(2).Label = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"T (PV^2/Hz)"

    </FONT></FONT><FONT size=2>

    FpSpread1.ActiveSheet.ColumnHeader.Columns(3).Label = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"V (PV^2/Hz)"

    </FONT></FONT><FONT size=2>

    FpSpread1.ActiveSheet.Columns(0).Width = 60


    FpSpread1.ActiveSheet.Columns(1).Width = 100


    FpSpread1.ActiveSheet.Columns(2).Width = 100


    FpSpread1.ActiveSheet.Columns(3).Width = 100


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>For</FONT></FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>To</FONT></FONT><FONT size=2> nCols - 1


    FpSpread1.ActiveSheet.Columns(i).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Next</FONT></FONT><FONT size=2> i


    FpSpread1.ActiveSheet.Columns(0, nCols - 1).AllowAutoSort = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>True

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>'add some dummy data

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>For</FONT></FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>To</FONT></FONT><FONT size=2> nRows - 1


    FpSpread1.ActiveSheet.SetText(i, 0, i.ToString)


    FpSpread1.ActiveSheet.SetText(i, 1, i.ToString)


    FpSpread1.ActiveSheet.SetText(i, 2, i.ToString)


    FpSpread1.ActiveSheet.SetText(i, 3, i.ToString)


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Next</FONT></FONT><FONT size=2> i


    FpSpread1.Update()


    FpSpread1.PrintSheet(0)

    </FONT>
  • Replied 8 September 2017, 1:57 pm EST

     


    The best option is to set BestFitCols to true and / or turn word wrap off on the headers.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels