मुद्रण flowdocument कहते हैं करने के लिए सीमा तालिका

0

सवाल

मैं निर्माण कर रहा हूँ flowdocument से ViewModel और फिर इसे मुद्रित करने के लिए pdf.

<UserControl x:Class="WpfApplication5.View.TransferTemplate" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:p="clr-namespace:WpfApplication5.Properties" xmlns:viewmodels="clr-namespace:WpfApplication5.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:WarehouseActionViewModel}" mc:Ignorable="d"
  x:Name="templ">
  <FlowDocument FontFamily="Cambria" FontSize="14" Background="White" x:Name="doc" d:ColumnWidth="1024">

    <Paragraph>
      <Run>Date: </Run>
      <Run Text="{Binding Action.ActionDate, StringFormat=dd-MM-yyyy}" />
    </Paragraph>
    <Paragraph>
      <Run>Note: </Run>
      <Run Text="{Binding Action.Note}" />
    </Paragraph>
    <Paragraph>
      <Run>Sender: </Run>
      <Run Text="{Binding Action.WarehouseFrom}" />
    </Paragraph>
    <Paragraph>
      <Run>Receiver: </Run>
      <Run Text="{Binding Action.WarehouseTo}" />
    </Paragraph>

    <Table x:Name="border" CellSpacing="0" BorderThickness="0" Background="{StaticResource WhiteBg}" BorderBrush="{StaticResource WhiteBg}">
      <Table.Columns>
        <TableColumn Width="0.2*" />
        <TableColumn Width="0.7*" />
        <TableColumn Width="0.1*" />
      </Table.Columns>

      <TableRowGroup>
        <TableRow FontSize="16">
          <TableCell BorderThickness="0,1,0,1" BorderBrush="#CCCCCC" Padding="5">
            <Paragraph>
              <Run Text="{x:Static p:Resources.barcode}" d:Text="Code" />
            </Paragraph>
          </TableCell>
          <TableCell BorderThickness="0,1,0,1" BorderBrush="#CCCCCC" Padding="5">
            <Paragraph>
              <Run Text="{x:Static p:Resources.Name}" d:Text="Name" />
            </Paragraph>
          </TableCell>
          <TableCell BorderThickness="0,1,0,1" BorderBrush="#CCCCCC" Padding="5">
            <Paragraph>
              <Run Text="{x:Static p:Resources.quantity}" d:Text="Quantity" />
            </Paragraph>
          </TableCell>
        </TableRow>
        <TableRow/>
      </TableRowGroup>
    </Table>
  </FlowDocument>
</UserControl>



PrintDialog printDlg = new PrintDialog();
        FlowDocument f = new TransferTemplate(vm).doc;
        f.ColumnWidth = printDlg.PrintableAreaWidth;
        IDocumentPaginatorSource dps = f;
        if ((bool)printDlg.ShowDialog())
        {
            printDlg.PrintDocument(dps.DocumentPaginator, "flow doc");
        }

समस्या है जब मैं इसे बनाने से टेम्पलेट और इसे प्रिंट जोड़ता है काले रंग की सीमा के लिए टेबल (सीमा मोटाई 0 पर सेट है) [![enter छवि विवरण यहाँ][1]][1]

लेकिन जब मैं बनाने के लिए दस्तावेज़ के बिना xaml टेम्पलेट के साथ एक ही कोड सी# में यह जोड़ नहीं है सीमा (सीमा मोटाई सेट नहीं)

var table1 = new Table
        {
            CellSpacing = 0,
            Background = Brushes.White
        };
        flowDoc.Blocks.Add(table1);
enter code here

[![enter छवि विवरण यहाँ][2]][2]

कैसे कर सकते हैं मैं ठीक XAML टेम्पलेट को निष्क्रिय करने के लिए सीमा? [1]: https://i.stack.imgur.com/BlYhX.png [2]: https://i.stack.imgur.com/HoZnF.png

flowdocument pdf printing wpf
2021-11-22 09:40:31
1

सबसे अच्छा जवाब

1

बस हटा दिया x:Name मेज से और यह काम किया!

टिप: जोड़ने के Name करने के लिए संपत्ति के किसी भी Flowdocument ब्लॉक तत्वों के लिए कहते हैं एक काले रंग की सीमा है जब मुद्रण (मैं केवल परीक्षण करने के लिए मुद्रण पीडीएफ).

2021-11-23 09:59:28

अन्य भाषाओं में

यह पृष्ठ अन्य भाषाओं में है

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

इस श्रेणी में लोकप्रिय

लोकप्रिय सवाल इस श्रेणी में