最新文章

LAN to LAN PPTP

Vigor 2960(vpn伺服端)

WAN:120.124.145.X

LAN:192.168.2.1

子網路遮罩:255.255.255.0/24

Vigor 2926(vpn客戶端)

WAN:125.229.46.X

LAN:192.168.1.254

子網路遮罩:255.255.255.0/24

Vigor 2960伺服端設定

Vigor 2926客戶端設定

看到這就代表PPTP連線成功。

進階應用:因為配合學校IP授權,將連線到120.124.X.X網域,限制只能透過VPN通道進行,則透過路由路由策略設定,設定如下:

因為透過VPN後,要連結至VIGOR2960管理介面必須透過192.168.2.1:50000,而無法用120.124.X.X:50000,因此透過限定埠號範圍方式,走WAN而不要走VPN通道,就可以解決該問題。設定如下圖:

如何在QNAPNAS中設定WordPress由HTTP轉換成HTTPS

首先先在WordPress目錄中的wp_config.php中增加下列程式碼:

define('WP_HOME','https://www.anderson.idv.tw/WordPress');
define('WP_SITEURL','https://www.anderson.idv.tw/WordPress');
$_SERVER['HTTPS'] = 'on';

增加wp_config.php中上述程式碼

然後更改QNAP NAS中控制台之網站伺服器,使用安全連線(HTTPS),並將通訊附設為443

至於是否強制使用安全連線(HTTPS)則無妨。

啟動HTTPS及更改PORT

如果使用NAS預設HTTPS PORT 8081,則上述程式碼必須加上埠號

define('WP_HOME','https://www.anderson.idv.tw:8081/WordPress');
define('WP_SITEURL','https://www.anderson.idv.tw:8081/WordPress');
$_SERVER['HTTPS'] = 'on';

以Excel的VBA進行word表單蒐集

很多人都知道 word可以進行表單的設計,但是很少人知道如何去收集表單上的資料,所以查了一下網絡上,然後改寫程式,主要除了判斷一般的文字外,尚可將表單中的圖片進行蒐集到Excel中。

執行該程式前,必須於VBA中設定引用項目。

於VBA中設定引用項目Word物件

以下為VBA程式:

Sub GetFormData()
'Note: this code requires a reference to the Word object model
Application.ScreenUpdating = False
Dim wdApp As New Word.Application, wdDoc As Word.Document, CCtrl As Word.ContentControl
Dim strFolder As String, strFile As String, WkSht As Worksheet, i As Long, j As Long
strFolder = GetFolder
If strFolder = "" Then Exit Sub
Set WkSht = ActiveSheet
i = WkSht.Cells(WkSht.Rows.Count, 1).End(xlUp).Row
strFile = Dir(strFolder & "*.docx", vbNormal)
While strFile <> ""
i = i + 1
Set wdDoc = wdApp.Documents.Open(Filename:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
j = 0
For Each CCtrl In .ContentControls
With CCtrl
Select Case .Type
Case Is = wdContentControlCheckBox
j = j + 1
WkSht.Cells(i, j).Value = .Checked
Case wdContentControlDate, wdContentControlDropdownList, wdContentControlRichText, wdContentControlText
j = j + 1
WkSht.Cells(i, j).Value = .Range.Text
Case Is = wdContentControlPicture
j = j + 1
WkSht.Cells(i, j).Value = .Range.Text
WkSht.Cells(i, j).Left = 100

       Case Else
    End Select
  End With
Next
.Close SaveChanges:=False

End With
strFile = Dir()
Wend
wdApp.Quit
Set wdDoc = Nothing: Set wdApp = Nothing: Set WkSht = Nothing
Application.ScreenUpdating = True
End Sub

Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function