20250120
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using Model;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Syncfusion.XlsIO;
|
||||
using Syncfusion.XlsIO.Implementation.XmlSerialization;
|
||||
|
||||
namespace DOCGEN.Klassen
|
||||
{
|
||||
@@ -65,6 +66,7 @@ namespace DOCGEN.Klassen
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
worksheet.Range[dv.FieldName].Text = dv.Value.ToString();
|
||||
}
|
||||
catch { }
|
||||
@@ -76,7 +78,7 @@ namespace DOCGEN.Klassen
|
||||
// Debug.Print(name.Value);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (docdata.Barcode == true)
|
||||
{
|
||||
@@ -116,7 +118,7 @@ namespace DOCGEN.Klassen
|
||||
row = Convert.ToInt32(dr["rowindex"]);
|
||||
col = Convert.ToInt32(dr["columnindex"]);
|
||||
|
||||
string value = workBook.Worksheets[Convert.ToInt32(dr["sheet"])-1].Range[row, col].DisplayText.ToString();
|
||||
string value = workBook.Worksheets[Convert.ToInt32(dr["sheet"]) - 1].Range[row, col].DisplayText.ToString();
|
||||
dr["value"] = value;
|
||||
}
|
||||
workBook.Close();
|
||||
@@ -150,19 +152,81 @@ namespace DOCGEN.Klassen
|
||||
{
|
||||
foreach (IName name in workBook.Names)
|
||||
{
|
||||
if (name.Name.ToString().ToUpper().Substring(0, 7) == "TGEDKBC")
|
||||
if (name.Name.ToString().ToUpper().Contains("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);
|
||||
string barcode = Bar25I(docData.Dokumentid.Substring(6, 16));
|
||||
worksheet.Range[name.Name].Value= barcode;
|
||||
//worksheet.Range[dv.FieldName].Text = dv.Value.ToString();
|
||||
//IPictureShape picture = worksheet.Pictures.AddPicture(row, col, barcodeimage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// System.Drawing.Im
|
||||
}
|
||||
// System.Drawing.Im
|
||||
}
|
||||
|
||||
public bool IsNumeric(string value)
|
||||
{
|
||||
return value.All(char.IsNumber);
|
||||
}
|
||||
public string Bar25I(string BarTextIn)
|
||||
{
|
||||
string Bar25IRet = default;
|
||||
string BarTextOut = "";
|
||||
string TempString = "";
|
||||
long CharValue = 0;
|
||||
string barcodeout = "";
|
||||
// Initialize input and output strings
|
||||
BarTextOut = "";
|
||||
BarTextIn = BarTextIn.Trim();
|
||||
|
||||
// Throw away non-numeric data
|
||||
TempString = "";
|
||||
for (int II = 1, loopTo = BarTextIn.Length; II <= loopTo; II++)
|
||||
{
|
||||
if (IsNumeric(BarTextIn.Substring(II - 1, 1)))
|
||||
{
|
||||
TempString = TempString + BarTextIn.Substring(II - 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// If not an even number of digits, add a leading 0
|
||||
if (TempString.Length % 2 == 1)
|
||||
{
|
||||
TempString = "0" + TempString;
|
||||
}
|
||||
|
||||
// Break digit pairs up and convert to characters- build output string
|
||||
for (int II = 1, loopTo1 = TempString.Length; II <= loopTo1; II += 2)
|
||||
{
|
||||
// Break string into pairs of digits and get value
|
||||
CharValue = Convert.ToInt32(TempString.Substring(II - 1, 2));
|
||||
// translate value to ASCII and save in BarTextOut
|
||||
if (CharValue < 90)
|
||||
{
|
||||
BarTextOut = BarTextOut + (char)(CharValue + 33);
|
||||
}
|
||||
else
|
||||
{
|
||||
BarTextOut = BarTextOut + (char)(CharValue + 71);
|
||||
}
|
||||
}
|
||||
|
||||
// Build ouput string, trailing space for Windows rasterization bug
|
||||
barcodeout = "{" + BarTextOut + "} ";
|
||||
|
||||
// Return the string
|
||||
Bar25IRet = barcodeout;
|
||||
return Bar25IRet;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user