views:

2223

answers:

1

Hi there im using the following code for insert text and images, but I want to insert the image "behind text" as Image>Adjust with Text property in MSWord

{
            int numeroInforme = Convert.ToInt32(txtNroInforme.Text);
            List<informeMedico> lstInformes = getInformeMedico(numeroInforme);


            FlowDocument mcFlowDoc = new FlowDocument();

            Paragraph para = new Paragraph();

            foreach (informeMedico info in lstInformes)
            {
                var signatureOne = BinaryImageConverter(info.firma1);
                var signatureTwo = BinaryImageConverter(info.firma2);

                para.Inlines.Add(new Run("RM Nro:" + "\t" + info.numeroinforme.ToString()));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run("Sr. Dr.  :" + "\t" + info.medicoCompleto.ToString()));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run("NOMBRE :" + "\t" + info.pacienteCompleto.ToString()));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run("EXAMEN :" + "\t" + info.estudioExamenNombre.ToString()));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run("FECHA :" + "\t" + info.fechainforme.ToString()));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run(info.tecnica));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run(info.hallazgo));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(new Run(info.conclusion));
                para.Inlines.Add(new Run("\n\n"));

                para.Inlines.Add(signatureOne);
                para.Inlines.Add(signatureTwo);
            }

            mcFlowDoc.Blocks.Add(para);

            mainRTB.Document = mcFlowDoc;


        }

Thanks in advance

+1  A: 

You can set the Background of the Paragraph, or of the individual Runs, to an ImageBrush:

<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
    <Grid.Resources>
        <FlowDocument x:Key="document">
            <Paragraph>
                <Paragraph.Background>
                    <ImageBrush ImageSource="http://sipi.usc.edu/database/misc/4.1.01.tiff" Stretch="UniformToFill"/>
                </Paragraph.Background>
                <Run Foreground="White" Text="this is some text"/>
                <LineBreak/>
                <Run Foreground="White" Text="and some more text"/>
            </Paragraph>
        </FlowDocument>
    </Grid.Resources>
    <FlowDocumentReader Document="{StaticResource document}"/>
</Grid>
Robert Macnee