I'm trying to add barcode into a table cell
Code:
MigraDoc.DocumentObjectModel.Shapes.Barcode bcode = table.Rows[Row - 1][Column - 1].Elements.AddBarcode();
bcode.Code = "code";
bcode.Text = true;
bcode.Type = BarcodeType.Barcode128;
and code
Code:
public void GeneratePreview()
{
string str = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(this.StickersDoc);
this.documentPreview1.Ddl = str;
}
throws exception on line this.documentPreview1.Ddl = str;
Code:
at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel)
at MigraDoc.Rendering.FormattedCell.Format(XGraphics gfx)
at MigraDoc.Rendering.TableRenderer.FormatCells()
at MigraDoc.Rendering.TableRenderer.InitFormat(Area area, FormatInfo previousFormatInfo)
at MigraDoc.Rendering.TableRenderer.Format(Area area, FormatInfo previousFormatInfo)
at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel)
at MigraDoc.Rendering.FormattedDocument.Format(XGraphics gfx)
at MigraDoc.Rendering.DocumentRenderer.PrepareDocument()
at MigraDoc.Rendering.Forms.DocumentPreview.DdlUpdated()
at MigraDoc.Rendering.Forms.DocumentPreview.set_Ddl(String value)
at BarCodeGenerator.FormBarcodes.GeneratePreview()
at BarCodeGenerator.FormBarcodes..ctor(Int32 Column, Int32 Row)
at BarCodeGeneratorTest.Form1.button1_Click(Object sender, EventArgs e) in D:\komponenty CH\BarCodeGenerator\BarCodeGeneratorTest\Form1.cs:line 27
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
If I put text instead of barcodes everything works fine, so the problem is for sure with barcode implementation