- - PR -
Excelオートシェイプで作成された図をgif保存
投稿者 | 投稿内容 | ||||
---|---|---|---|---|---|
|
投稿日時: 2005-09-15 13:50
なおこ(・∀・)さん、かつのりさんできました!
お二人のあわせ技です。もちろんExcelのタスクは残りません。 以下がソースです↓ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim xlApp As Excel.Application = New Excel.Application Dim xlBooks As Excel.Workbooks = xlApp.Workbooks Dim xlBook As Excel.Workbook Dim xlSheets As Excel.Sheets Dim xlSheet As Excel.Worksheet Dim excel_path As String = "D:\\Book1.xls" Try xlBook = xlBooks.Open(excel_path, , False) xlSheets = xlBook.Worksheets xlSheet = CType(xlSheets.Item(1), Excel.Worksheet) xlSheet.Shapes.SelectAll() xlApp.Selection.CopyPicture(Appearance:=Excel.XlPictureAppearance.xlScreen, _ Format:=Excel.XlCopyPictureFormat.xlBitmap) Dim iData As IDataObject = Clipboard.GetDataObject() Dim bmpData As Object = iData.GetData(System.Windows.Forms.DataFormats.Bitmap) Dim imgData As System.Drawing.Image = CType(bmpData, Image) imgData.Save("C:\\Test.gif", System.Drawing.Imaging.ImageFormat.Gif) Catch ex As Exception Throw ex Finally Try System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheets) If Not IsNothing(xlBook) Then xlBook.Close(False) End If System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBooks) If Not IsNothing(xlApp) Then xlApp.Quit() End If System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp) Catch ex As Exception End Try End Try End Sub ありがとうございましたぁ。 | ||||
|
投稿日時: 2005-09-15 22:01
XP をサーバーにして、Office 2003 を使うのですか?
それって、ライセンス的にどうなのかな? Office 2003 を、サーバーサイドで使うには、アクセスしてくる人の数だけの Office ライセンスが必要です(要確認)。 また、XP では、同時接続は5接続までに制限されます。 そういうところは、大丈夫なのでしょうか? _________________ | ||||
|
投稿日時: 2005-09-15 22:12
すいません。私の書き方が悪かったですね。 現在、テスト的な開発としてXP端末を使っています。 実運用はWin2003Serverです。 Officeに関しても各クライアントにはすべてライセンスを保持しています。 サーバサイドで処理するから各端末でライセンスが2個ずつ必要とは ならないかなと勝手に想像していました。 確認は必要ですけどね。 的確なご意見ありがとうございます。 |