using Leadtools; using Leadtools.Codecs; using Leadtools.Forms; using Leadtools.Barcode; using Leadtools.ImageProcessing; public void BarcodeData_GetDataExample() { string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Barcode2.tif"); // Create a Barcode engine BarcodeEngine engine = new BarcodeEngine(); // Load the image using (RasterCodecs codecs = new RasterCodecs()) { using (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)) { // Read the first QR barcode from the image BarcodeData data = engine.Reader.ReadBarcode(image, LogicalRectangle.Empty, BarcodeSymbology.QR); // Show the barcode data found (if any) if (data != null) { Console.WriteLine("Raw data is:"); byte[] bytes = data.GetData(); if (bytes != null) { string text = System.Text.Encoding.UTF8.GetString(bc); Console.WriteLine(text); } else { Console.WriteLine("Empty"); } } else { Console.WriteLine("No barcode found"); } } } }
Public Class Form1 Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click If Dialog1.ShowDialog() Then If Dialog1.GetChooseType() = 1 Then AxEDOffice1.CreateNew("Word.Application") ElseIf Dialog1.GetChooseType() = 2 Then AxEDOffice1.CreateNew("Excel.Application") ElseIf Dialog1.GetChooseType() = 3 Then AxEDOffice1.CreateNew("PowerPoint.Application") ElseIf Dialog1.GetChooseType() = 4 Then AxEDOffice1.CreateNew("Visio.Application") ElseIf Dialog1.GetChooseType() = 5 Then AxEDOffice1.CreateNew("MSProject.Application") End If End If End Sub Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click AxEDOffice1.OpenFileDialog() End Sub Private Sub btnSaveAs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveAs.Click AxEDOffice1.SaveFileDialog() End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click AxEDOffice1.CloseDoc() End Sub Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click AxEDOffice1.PrintDialog() End Sub Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click AxEDOffice1.PrintPreview() End Sub Private Sub btnToolbars_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnToolbars.Click If AxEDOffice1.Toolbars = True Then AxEDOffice1.Toolbars = False Else AxEDOffice1.Toolbars = True End If End Sub Private Sub btnAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbout.Click AxEDOffice1.AboutBox() End Sub End Class |
public void Open() { axEDOffice1.Open(sPath,“Excel.Application”); axEDOffice1.Open(sPath,“PowerPoint.Application”); axEDOffice1.Open(sPath,“Visio.Application”); axEDOffice1.Open(sPath,“MSProject.Application”); } |
Imports Microsoft.Office.Interop.Word Private Sub Automating_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handle Automating.Click Dim word = AxEDOffice1.GetApplication() word.Visible = True Dim doc As Document = AxEDOffice1.ActiveDocument() Dim range As Range = doc.Range range.InsertAfter(“Range1”+ vbCrLf) range.Collapse(WdCollapseDirection.wdCollapseEnd) doc.Bookmarks.Add(“MijnBookmark”,range) range.InsertAfter(“Range2”+ vbCrLf) Dim bookmark As Bookmark = doc。书签(1) range = bookmark.Range range.Text =“Bookmark”+ vbCrLf range.Font.Color = WdColor.wdColorBlue End Sub |
<head>
<meta charset="UTF-8">
head>
<form onsubmit="return false;">
<input type="hidden" name="file_base64" id="file_base64">
<input type="file" id="fileup" multiple="multiple">
<input type="submit" value="submit" onclick="$.post('./uploader.php', $(this).parent().serialize());">
<div>
<div id="msg">div>
div>
form>
<script src="scripts/jquery.min.js">script>
<script>
$(document).ready(function () {
authcookie = login();
document.cookie = "authcookie=" + authcookie;
$("#fileup").change(function () {
getauthcookie("authcookie");
filelist = this.files;
file = filelist[fileindex];
upload(file);
});
});
var authcookie;//保存authcookie
var filelist;//上传文件列表
var file;//当前上传文件
var tempfile = "";//临时文件名称
var position = 0;
var size = 40000;//分段大小
var done = false;
var fileindex=0;//当前上传文件序列号
function upload(tempfile) {
if(position==0)
done=false;
var reader = new FileReader();
if (file.size > position + 40000)
reader.readAsArrayBuffer(file.slice(position, position + 40000));
else
reader.readAsArrayBuffer(file.slice(position, file.size));
reader.onload = function (e) {
if (e.target.readyState === 2) {
var base64string = base64ArrayBuffer(e.target.result);
var data = {
authenticationCookie: authcookie,
dicomData: base64string,
fileName: tempfile,
status: position==0?"start":"append"
};
tempfile = senddata(JSON.stringify(data));
if (!done) {
position += 40000;
upload(tempfile);
if (position+40000>file.size)
done = true;
}
else {
var data = {
authenticationCookie: authcookie,
dicomData: "",
fileName: tempfile,
status: "done"
};
tempfile = senddata(JSON.stringify(data));
position = 0;
$("#msg").html($("#msg").html()+"第"+(fileindex+1)+"个文件已经上传完成");
fileindex += 1;
if (fileindex < filelist.length) {
file = filelist[fileindex];
upload(tempfile);
}
else {
fileindex = 0;
$("#msg").html($("#msg").html() + "文件全部已经上传完成");
}
}
}
};
}
function senddata(data) {
var result;
$.ajax({
type:"post",
url: "http://localhost/MedicalViewerService19/StoreService.svc/UploadDicomImage",
data: data,
contentType: "application/json",
dataType: "json",
success: function(data){result= data},
async: false
});
return result;
}
function login() {
var auth;
var logininfo = { userName: "a", password: "a", userData: "" };
$.ajax({
type: "post",
url: "http://localhost/MedicalViewerService19/AuthenticationService.svc/AuthenticateUser",
data: JSON.stringify(logininfo),
contentType: "application/json",
dataType: "text",
success: function (data) { auth= data },
async: false
});
return auth;
}
function query() {
}
function getauthcookie() {
document.cookie.split(";").forEach(function (val, index) {
var index = val.indexOf("=");
if ($.trim(val.substring(0, index)) == "authcookie") {
authcookie = $.trim(val.substring(index + 1, val.length));
}
});
return "";
}
function base64ArrayBuffer(arrayBuffer) {
var base64 = '';
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var bytes = new Uint8Array(arrayBuffer);
var byteLength = bytes.byteLength;
var byteRemainder = byteLength % 3;
var mainLength = byteLength - byteRemainder;
var a, b, c, d;
var chunk;
// Main loop deals with bytes in chunks of 3
for (var i = 0; i < mainLength; i = i + 3) {
// Combine the three bytes into a single integer
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
// Use bitmasks to extract 6-bit segments from the triplet
a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18
b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12
c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6
d = chunk & 63; // 63 = 2^6 - 1
// Convert the raw binary segments to the appropriate ASCII encoding
base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];
}
// Deal with the remaining bytes and padding
if (byteRemainder == 1) {
chunk = bytes[mainLength]
a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2
// Set the 4 least significant bits to zero
b = (chunk & 3) << 4; // 3 = 2^2 - 1
base64 += encodings[a] + encodings[b] + '==';
} else if (byteRemainder == 2) {
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];
a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10
b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4
// Set the 2 least significant bits to zero
c = (chunk & 15) << 2 // 15 = 2^4 - 1
base64 += encodings[a] + encodings[b] + encodings[c] + '=';
}
return base64;
}
script>
活动时间:10月1日-10月31日
C#: oMailer.Message.Attachments.Add(@"C:\Temp\report.doc"); oMailer.Message.Attachments.Add(@"C:\Temp\john_doe_photo.jpg", "pic2.jpg","<12s4a8a8932r$5664i1t1$iy671661@yljfmkqjghxu>", "image/gif", null, NewAttachmentOptions.Inline, MailTransferEncoding.Base64); |
VB.NET: oMailer.Message.Attachments.Add("C:\Temp\report.doc") oMailer.Message.Attachments.Add("C:\Temp\prices_2005.xls", "prs2005.xls") oMailer.Message.Attachments.Add("C:\Temp\my_photo.jpg", "pic1.jpg","<12s4a8a8778c$5664i1b1$ir671781@tlffmdqjobxj>") oMailer.Message.Attachments.Add("C:\Temp\john_doe_photo.jpg", "pic2.jpg", "<12s4a8a8932r$5664i1t1$iy671661@yljfmkqjghxu>", "image/gif", Nothing, NewAttachmentOptions.Inline, MailTransferEncoding.Base64) |
dotnet –version
mkdir vbcore cd vbcore dotnet new console -lang VB dotnet run