已答覆 Multi Line text in xpsdocument FixedDocument ?

  • martedì 24 aprile 2012 22:03
     
     
    Hi,
    I try to create a XPS doucmet with a Text to display in it.
    I read many samples in MSDN and in this MSDN Form.
    But i couldn't able to find a single sample with
    a Multi Line Text. Dont know why..
    All i find is "Hello XPS", "Hello World" "Hi".. etc...

    I need a string with long sentence like the below one.
    Eg : "This is a long sentence, which i want it to display in a multiple lines with the "Justify" format. Is it possible. Please Help me. Am help less."

    I tried in this way(below):
    <FixedPage Width="816" Height="1056" xmlns="http://schemas.microsoft.com/xps/2005/06" xml:lang="und"
    <Glyphs  
    Fill="#ff000000"  
    FontUri="/Documents/1/Resources/Fonts/95AC3A6D-FFED-4988-A14D-E467DC4ACC27.odttf"  
    FontRenderingEmSize="15.9697"
    StyleSimulations="None"  
    OriginX="120"  
    OriginY="110.4"  
    UnicodeString="This is a long sentence, which i want it to display in a multiple lines with the "Justify" formate. Is it possible. Please Help me. Am help less."  
    />
    </FixedPage>

    But my XPS document is creating in a straight Single line. With out Line Break.
    Please Help me.
    Hope you understand my requirement and the question.
    Waiting for your reply.

    Regards,

Tutte le risposte

  • martedì 24 aprile 2012 22:38
     
     
    <html>
    <head>
    <meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8">
    <meta name="ProgId" content="ODC.New">
    <meta name="SourceType" content="NewOLEDB">
    </head>
    </html>

    2085712698@att.net

  • martedì 1 maggio 2012 17:01
    Moderatore
     
     Con risposta Contiene codice

    Hi

    You can check out below code for your reference:

     private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
          //create WPF Control to be printed   
          StackPanel mystackpanel = new StackPanel();
          TextBlock TB1 = new TextBlock();
          TB1.Text="TextBlock1";
          TextBlock TB2 = new TextBlock();
          TB2.Text="TextBlock2";
          mystackpanel.Children.Add(TB1);
          mystackpanel.Children.Add(TB2);
          FixedDocument fixedDoc = new FixedDocument(); 
          PageContent pageContent = new PageContent();   
          FixedPage fixedPage = new FixedPage();    //Create first page of document   
          fixedPage.Children.Add(mystackpanel);   
          ((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);   
          fixedDoc.Pages.Add(pageContent);   //Create any other required pages here    
          //View the document   
          documentViewer1.Document = fixedDoc; }  
        }

    In XAML:

    <DocumentViewer Name="documentViewer1"/>

    Hope it helps.

    If you have any additional questions, please feel free to let me know.

    Have a nice day.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

  • venerdì 4 maggio 2012 09:14
    Moderatore
     
     
    We are temporarily marking this as "Answer", if you have any concerns or new findings; please feel free to let me know.
    Best regards.

    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us