Update 20241229
This commit is contained in:
@@ -59,7 +59,7 @@ namespace DOCGEN.Klassen
|
||||
{
|
||||
foreach (IWorksheet worksheet in workBook.Worksheets)
|
||||
{
|
||||
if (dv.FieldName== "TGEDKNameInhaber")
|
||||
if (dv.FieldName == "TGEDKNameInhaber")
|
||||
{
|
||||
var a = 0;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace DOCGEN.Klassen
|
||||
{
|
||||
worksheet.Range[dv.FieldName].Text = dv.Value.ToString();
|
||||
}
|
||||
catch { }
|
||||
catch { }
|
||||
|
||||
//foreach (IName name in worksheet.Names)
|
||||
//{
|
||||
@@ -76,8 +76,13 @@ namespace DOCGEN.Klassen
|
||||
// Debug.Print(name.Value);
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (docdata.Barcode == true)
|
||||
{
|
||||
Insert_Barcode(workBook, docdata);
|
||||
}
|
||||
|
||||
MemoryStream destms = new MemoryStream();
|
||||
workBook.SaveAs(destms);
|
||||
workBook.Close();
|
||||
@@ -119,5 +124,45 @@ namespace DOCGEN.Klassen
|
||||
ex.Dispose();
|
||||
|
||||
}
|
||||
}
|
||||
public void Insert_Barcode(IWorkbook workBook, clsDocData docData)
|
||||
{
|
||||
System.Drawing.Image barcodeimage;
|
||||
BarcodeLib.Barcode Barcode = new BarcodeLib.Barcode();
|
||||
switch (docData.barcode_type)
|
||||
{
|
||||
case "0":
|
||||
int rotation = 0;
|
||||
if (docData.barcode_horizontal == 0) { rotation = 270; }
|
||||
barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5, docData.Dokumentid.Substring(6, 16), docData.Dokumentid.Substring(6, 16) + docData.barcode_zusatz, docData.barcode_textposition, docData.Zusatz_Font, Convert.ToInt32(docData.Zusatz_FontSize), rotation);
|
||||
break;
|
||||
case "1":
|
||||
|
||||
//barcodeimage = Barcode.Get_Datamatrix(DataMatrix.net.DmtxScheme.DmtxSchemeAutoBest, docData.barcode_content, 4, 0, 0, "Left", docData.barcode_content, docData.barcode_font, docData.barcode_fontsize);
|
||||
|
||||
barcodeimage = Barcode.Get_Datamatrix(DataMatrix.net.DmtxScheme.DmtxSchemeAscii, docData.barcode_content, 6, 6, 0, "Right", docData.barcode_text + docData.barcode_zusatz, docData.barcode_font, docData.barcode_fontsize + 5);
|
||||
//barcodeimage.Save(@"x:\bctest.png");
|
||||
break;
|
||||
default:
|
||||
barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5C, docData.Dokumentid.Substring(9, 13), docData.Dokumentid.Substring(6, 16) + docData.barcode_zusatz, docData.barcode_textposition, docData.barcode_font, Convert.ToInt32(docData.barcode_fontsize), 0);
|
||||
break;
|
||||
}
|
||||
foreach (IWorksheet worksheet in workBook.Worksheets)
|
||||
{
|
||||
foreach (IName name in workBook.Names)
|
||||
{
|
||||
if (name.Name.ToString().ToUpper().Substring(0, 7) == "TGEDKBC")
|
||||
{
|
||||
int i = name.Index;
|
||||
int row = worksheet.Range[name.Name].Row;
|
||||
int col = worksheet.Range[name.Name].Column;
|
||||
|
||||
IPictureShape picture = worksheet.Pictures.AddPicture(row, col, barcodeimage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// System.Drawing.Im
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user