开发者

WiX Simple Line Break?

Using 3.5 and I just want a newline character in my Text Element:

<Dialog><Control><Text>
    &#13;&#10;The [Wizard] will 开发者_如何学编程install [ProductName]
    &#13;&#10;on your computer.
    &#13;&#10;Click Next to continue or Cancel to exit the [Wizard].
</Text></Control>....

That does not seem to insert a new line character. How can I get a linebreak in there?

Thanks.


Unfortunately Windows Installer doesn’t support line breaks in static text controls. During installation the text is automatically formatted based on control and font sizes.

However, if you really want a line break, simply use another static text control for the next line.


The official answer from Microsoft regarding line breaks in Text controls reads as follows:

The recommended method for displaying text with specified line breaks is to use multiple one-line text controls located below each other. The character sequences \n, \r\n, or \n\r in the text field for the control are not displayed as a line break. These character sequences are literally displayed by the control.


Use CDATA as stumbled upon in this question:

<Control><Text>
<![CDATA[
This is my text.
With a return line
]]>
</Text></Control>


Building on Adam's answer you can also format your text into a WixLocalization entry. Example:

 <WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Culture="en-US">
    <String Id="WelcomeDlgDescription">
        This is a custom welcome message. 
        Click Next to continue or 
        Cancel to exit.</String>
  </WixLocalization>

And use it in your control like this:

<Control Id="Description" Type="Text" X="50" Y="20" Width="200" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜