匯出 DataGridView 資料到 Excel Imports ClosedXML.Excel Using stream As FileStream = New FileStream(filePath, FileMode.Open, FileAccess.ReadWrite) Using memoryStream As New MemoryStream() ' 初始化ExcelPackage,並讀取模板 Using workbook As New XLWorkbook(stream) Dim worksheet = workbook.Worksheet(1) ' 假設操作第一個工作表 #Region "塞入欄位" worksheet.Cells("A6").Value = "需填入的值" #End Region '儲存 Excel 文件到 MemoryStream workbook.SaveAs(memoryStream) End Using Dim sfd As New SaveFileDialog() sfd.Filter = "Excel(*.xlsx)|*.xlsx" ' 設定預設檔案名稱 sfd.FileName = "檔案名稱" + ".xlsx" If (sfd.ShowDialog() = DialogResult.OK) Then '將 MemoryStream 位置重設為 0 (從頭開始讀取) memoryStream.Position = 0 '將 Stream 轉換為 Byte 陣列並寫入檔案 My.Computer.FileSystem.WriteAllBytes(sfd.FileName, ...
#Create a simulator object set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the NAM trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the NAM trace file close $nf #Execute NAM on the trace file exec nam out.nam & exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns duplex-link $n2 $n3 1.7Mb 20ms DropTail #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 10 #Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right #Monitor the queue for link (n2-n3). (for NAM) $ns duplex-link-op $n2 $n3 queuePos...
留言
張貼留言
歡迎留言