개정판 f9faf398
issue #000: Gembox image Size 변경, 기본 cell width, height 값 설정, Image Size에 따라서 크기 조정
Change-Id: I8a2851653417e5e1eccfa0c4e48f63219d8208ec
KCOM/Controls/CheckList.xaml.cs | ||
---|---|---|
428 | 428 |
// Excel 첫번째 워크시트 가져오기 |
429 | 429 |
workbook = ExcelFile.Load(dialog.FileName); |
430 | 430 |
worksheet = workbook.Worksheets[0]; |
431 |
|
|
431 |
|
|
432 | 432 |
// 데이타 넣기 |
433 | 433 |
int h = 8; |
434 | 434 |
int w = 1; |
... | ... | |
468 | 468 |
CellRange Filter_Range = worksheet.Cells.GetSubrange("B9:" + Ran + "9"); |
469 | 469 |
Filter_Range.Filter(true); |
470 | 470 |
ExcelCell Range_b = worksheet.Cells["B10"]; |
471 |
Range_b.Row.SetHeight(190, LengthUnit.Pixel); |
|
471 | 472 |
Lists.ForEach(data => |
472 | 473 |
{ |
473 | 474 |
h++; |
... | ... | |
480 | 481 |
|
481 | 482 |
if (data.IMAGE_PATH != null) |
482 | 483 |
{ |
483 |
ExcelCell ImageRange = worksheet.Cells[h, w + 2];
|
|
484 |
ExcelCell ImageRange = worksheet.Cells[h, w + 2]; |
|
484 | 485 |
ImageRange.Row.Height = Range_b.Row.Height; |
485 |
//ImageRange.Style.Font.Size = 10; |
|
486 | 486 |
System.Drawing.Image I_Image = byteArrayToImage(data.IMAGE_PATH); |
487 |
System.Drawing.Image o_Image = Resize(I_Image, 80, 80); |
|
487 |
System.Drawing.Image o_Image = Resize(I_Image, 180, 180); |
|
488 |
|
|
488 | 489 |
System.Windows.Forms.Clipboard.SetDataObject(o_Image, true); |
489 | 490 |
ImageRange.Style.HorizontalAlignment = HorizontalAlignmentStyle.Left; |
490 | 491 |
ImageRange.Style.VerticalAlignment = VerticalAlignmentStyle.Top; |
... | ... | |
494 | 495 |
int column = 2; // 이미지를 삽입할 열 |
495 | 496 |
int row = h; // 이미지를 삽입할 행 |
496 | 497 |
// 이미지를 워크시트에 추가 |
497 |
ExcelPicture picture = worksheet.Pictures.Add(memoryStream, PositioningMode.FreeFloating, new AnchorCell(ImageRange.Column, ImageRange.Row, 0, 0), ExcelPictureFormat.Jpeg); |
|
498 |
ExcelPicture picture = worksheet.Pictures.Add(memoryStream, PositioningMode.Move, new AnchorCell(ImageRange.Column, ImageRange.Row, 0, 0), ExcelPictureFormat.Jpeg); |
|
499 |
picture.Position.SetTop(picture.Position.Top + 7, LengthUnit.Point); |
|
500 |
picture.Position.SetLeft(picture.Position.Left + 7, LengthUnit.Point); |
|
501 |
|
|
502 |
int Height = o_Image.Height > 100 ? o_Image.Height : 100; |
|
503 |
ImageRange.Row.SetHeight(Height + 20, LengthUnit.Pixel); |
|
498 | 504 |
|
499 | 505 |
//foreach (Microsoft.Office.Interop.Excel.Shape shp in worksheet.Shapes) |
500 | 506 |
//{ |
... | ... | |
540 | 546 |
worksheet.Cells[h, w + 26].Value = data.REV_17 == null ? "" : data.REV_17.Replace("", " / "); |
541 | 547 |
worksheet.Cells[h, w + 27].Value = data.REV_18 == null ? "" : data.REV_18.Replace("", " / "); |
542 | 548 |
worksheet.Cells[h, w + 28].Value = data.REV_19 == null ? "" : data.REV_19.Replace("", " / "); |
549 |
//worksheet.Rows[h] |
|
550 |
|
|
543 | 551 |
#endregion |
544 | 552 |
}); |
545 | 553 |
|
... | ... | |
548 | 556 |
worksheet.Columns[columnIndex].AutoFit(); |
549 | 557 |
} |
550 | 558 |
|
559 |
worksheet.Columns["D"].SetWidth(200, LengthUnit.Pixel); |
|
551 | 560 |
worksheet.Columns["G"].Width = Convert.ToInt32(worksheet.Columns["G"].Width * 1.1); |
552 | 561 |
// 엑셀파일 저장 |
553 | 562 |
workbook.Save(dialog.FileName); |
내보내기 Unified diff