This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" | |
Inherits="tx_documentviewer_style.index" %> | |
<%@ Register assembly="TXDocumentServer, Version=22.0.800.500, | |
Culture=neutral, PublicKeyToken=6b83fe9a75cfb638" | |
namespace="TXTextControl.DocumentServer.Web" tagprefix="cc1" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE [dbo].[Categories] ( | |
[CategoryId] [int] NOT NULL IDENTITY, | |
[Name] [nvarchar](max), | |
CONSTRAINT [PK_dbo.Categories] PRIMARY KEY ([CategoryId]) | |
) | |
CREATE TABLE [dbo].[Products] ( | |
[ProductId] [int] NOT NULL IDENTITY, | |
[Name] [nvarchar](max), | |
[CategoryId] [int] NOT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DataSelector | |
// description: This class loops through all merge blocks in a given template to check | |
// for sort keywords. The given referenced DataSet will be sorted. | |
// | |
// Parameters: dataSet of type DataSet, template as a byte[] array in the InternalUnicodeFormat | |
public class DataSelector | |
{ | |
public byte[] Template { get; set; } | |
public DataSelector(DataSet dataSet, byte[] template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string sDataSource = "data.xml"; | |
private string sTemplateFile = "template.tx"; | |
private void mergeToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
// convert the XML file to a .NET DataSet | |
DataSet ds = new DataSet(); | |
ds.ReadXml(sDataSource, XmlReadMode.Auto); | |
// create a new DataSelector instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void InsertWatermarkImages() | |
{ | |
// remove all existing watermarks | |
RemoveWatermarkImages(textControl1); | |
foreach (TXTextControl.Page page in textControl1.GetPages()) | |
{ | |
// create a new watermark image | |
Bitmap bmp = CreateDraftImage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void RemoveWatermarkImages(TXTextControl.TextControl textControl) | |
{ | |
// List of images to be deleted | |
List<TXTextControl.Image> lImagesToRemove = | |
new List<TXTextControl.Image>(); | |
// loop through all images and check for the Name | |
foreach (TXTextControl.Image img in textControl1.Images) | |
{ | |
// add watermark images to the List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int iNumberOfPages = 1; | |
// update the watermarks if the number of pages are different | |
private void textControl1_Changed(object sender, EventArgs e) | |
{ | |
if (textControl1.Pages > iNumberOfPages) | |
{ | |
InsertWatermarkImages(); | |
iNumberOfPages = textControl1.Pages; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creates a new "DRAFT" sample image | |
private Bitmap CreateDraftImage() | |
{ | |
string sText = "DRAFT"; | |
Bitmap destination = new Bitmap(400, 400); | |
using (Graphics g = Graphics.FromImage(destination)) | |
{ | |
GraphicsUnit units = GraphicsUnit.Pixel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*---------------------------------------------------------- | |
** MultipagePrintDocument class | |
**--------------------------------------------------------*/ | |
class MultipagePrintDocument : PrintDocument | |
{ | |
/*------------------------------------------------------ | |
** Constructor | |
** description: Initializes the private data fields | |
**----------------------------------------------------*/ | |
public MultipagePrintDocument(TXTextControl.TextControl textControl, |
OlderNewer