コード例 #1
0
ファイル: Word.cs プロジェクト: jdaomilang/report-generator
        private void RenderPhotoRow(PhotoRowLayout layout, ITableRow row)
        {
            //	In the design we represent a photo row as a pair of table rows
            //	without a table: one row for the photos, and the other for the
            //	captions. This design is useful for PDF, and requires special
            //	handling of borders to make the vertical pairs of cells (photo
            //	cell and caption cell) appear as a single cell. But it's not
            //	necessary in Word because we can just add the photo and caption
            //	as two paragraphs in a single cell. So deconstruct the photo
            //	row into its pairs of cells and then render each pair as a
            //	single cell.
            for (int x = 0; x < layout.NumPhotos; ++x)
            {
                PhotoLayout photoCell   = (PhotoLayout)layout.PhotoRow.GetSubLayoutAtIndex(x).GetSubLayoutAtIndex(0);
                TextLayout  captionCell = (TextLayout)layout.CaptionRow.GetSubLayoutAtIndex(x).GetSubLayoutAtIndex(0);

                s.TableCellStyle cellStyle = null;
                if (layout.Style != null)
                {
                    s.PhotoStyle photoStyle = (s.PhotoStyle)layout.Style;
                    cellStyle = new s.TableCellStyle
                    {
                        Padding = photoStyle.Padding
                    };
                }
                ITableCell cell = row.AddCell(1, cellStyle, layout.TrackingInfo);
                RenderPhoto(photoCell, cell);
                RenderText(captionCell, cell);
            }
        }
コード例 #2
0
ファイル: Word.cs プロジェクト: jdaomilang/report-generator
        private void RenderTableCell(TableCellLayout layout, ITableRow row)
        {
            ITableCell cell = row.AddCell(layout.ColumnSpan, (s.TableCellStyle)layout.Style, layout.TrackingInfo);

            foreach (Layout sublayout in layout.SubLayouts)
            {
                Render(sublayout, cell);
            }
        }