working on it ...

Filters

snippets
27
followers
4
Published by sherazam

Cool stuff by sherazam

This channel collects the brain compositions of this guy
Sort by

Found 27 snippets

    public by sherazam  120635  0  5  0

    How to Set Line Spacing of a Paragraph in an Excel Shape or Textbox inside .NET Apps

    This technical tip shows how to Set Line Spacing of the Paragraph in a Shape or Textbox in .NET applications. You can set the line space of the paragraph, its space before and space after using the TextParagraph.LineSpace, TextParagraph.SpaceBefore and TextParagraph.SpaceAfter respectively. The following example shows how to Set Line Spacing of the
    // Enter here the actual content of the snippet.            
    
    //[C# Code]
     
    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
    // The path to the documents directory.
    string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    
    // Create a workbook
    Workbook wb = new Workbook();
    
    // Access first worksheet
    Worksheet ws = wb.Worksheets[0];
    
    // Add text box inside the sheet
    ws.Shapes.AddTextBox(2, 0, 2, 0, 100, 200);
    
    // Access first shape which is a text box and set is text
    Shape shape = ws.Shapes[0];
    shape.Text = "Sign up for your free phone number.\nCall and text online for free.";
    
    // Acccess the first paragraph
    TextParagraph p = shape.TextBody.TextParagraphs[1];
    
    // Set the line space
    p.LineSpaceSizeType = LineSpaceSizeType.Points;
    p.LineSpace = 20;
    
    // Set the space after
    p.SpaceAfterSizeType = LineSpaceSizeType.Points;
    p.SpaceAfter = 10;
    
    // Set the space before
    p.SpaceBeforeSizeType = LineSpaceSizeType.Points;
    p.SpaceBefore = 10;
    
    // Save the workbook in xlsx format
    wb.Save(dataDir + "output_out_.xlsx", SaveFormat.Xlsx); 
    
    //[VB.NET Code]
    
    ' For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
    ' The path to the documents directory.
    Dim dataDir As String = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
    
    ' Create a workbook
    Dim wb As New Workbook()
    
    ' Access first worksheet
    Dim ws As Worksheet = wb.Worksheets(0)
    
    ' Add text box inside the sheet
    ws.Shapes.AddTextBox(2, 0, 2, 0, 100, 200)
    
    ' Access first shape which is a text box and set is text
    Dim shape As Shape = ws.Shapes(0)
    shape.Text = "Sign up for your free phone number." & vbLf & "Call and text online for free."
    
    ' Acccess the first paragraph
    Dim p As TextParagraph = shape.TextBody.TextParagraphs(1)
    
    ' Set the line space
    p.LineSpaceSizeType = LineSpaceSizeType.Points
    p.LineSpace = 20
    
    ' Set the space after
    p.SpaceAfterSizeType = LineSpaceSizeType.Points
    p.SpaceAfter = 10
    
    ' Set the space before
    p.SpaceBeforeSizeType = LineSpaceSizeType.Points
    p.SpaceBefore = 10
    
    ' Save the workbook in xlsx format
    wb.Save(dataDir & Convert.ToString("output_out_.xlsx"), SaveFormat.Xlsx) 
    
    

    public by sherazam  2150  0  5  0

    How to Add Rectangle or Line Object to An Existing PDF File using .NET

    This technical tip shows how .NET developers can add line object to an Existing PDF File inside their .NET applications. Aspose.Pdf for .NET supports the feature to add graph objects (for example graph, line, rectangle etc.) to PDF documents. You also get the leverage to add Line object where you can also specify the dash pattern, color and other f
    // Enter here the actual content of the snippet.   
    //The following code snippet shows how to add a Rectangle object that is filled with color.
    
    //[C# Code]
     
    // Create Document instance
    Document doc = new Document();
    // Add page to pages collection of PDF file
    Page page = doc.Pages.Add();
    // Create Graph instance
    Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(100, 400);             
    // Add graph object to paragraphs collection of page instance
    page.Paragraphs.Add(graph);
    // Create Rectangle instance
    Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[]{100, 100, 200, 100});
    // Specify fill color for Graph object
    line.GraphInfo.DashArray = new int[] { 0, 1, 0 };
    line.GraphInfo.DashPhase = 1;
    // Add rectangle object to shapes collection of Graph object
    graph.Shapes.Add(line);
    // Save PDF file
    doc.Save("c:/pdftest/LineAdded.pdf");
    
    //[VB.NET Code]
     
    ' Create Document instance
    Dim doc As Document = New Document()
    ' Add page to pages collection of PDF file
    Dim page As Page = doc.Pages.Add()
    ' Create Graph instance
    Dim graph As Aspose.Pdf.Drawing.Graph = New Aspose.Pdf.Drawing.Graph(100, 400)
    ' Add graph object to paragraphs collection of page instance
    page.Paragraphs.Add(graph)
    ' Create Rectangle instance
    Dim line As Aspose.Pdf.Drawing.Line = New Aspose.Pdf.Drawing.Line(New Single() {100, 100, 200, 100})
    ' Specify fill color for Graph object
    line.GraphInfo.DashArray = New Integer() {0, 1, 0}
    line.GraphInfo.DashPhase = 1
    ' Add rectangle object to shapes collection of Graph object
    graph.Shapes.Add(line)
    ' Save PDF file
    doc.Save("c:/pdftest/LineAdded.pdf")
    
    //DashLengthInBlack and DashLengthInWhite properties for Line object
    
    //[C# Code]
     
     // instantiate Document instance
    Document doc = new Document();
    // add page to pages collection of Document object
    Page page = doc.Pages.Add();
    // create Drawing object with certain dimensions
    Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
    // add drawing object to paragraphs collection of page instance
    page.Paragraphs.Add(canvas);
    // create Line object
    Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 });
    // set color for Line object
    line.GraphInfo.Color = Aspose.Pdf.Color.Red;
    // specify dash array for line object
    line.GraphInfo.DashArray = new int[] { 0, 1, 0 };
    // set the dash phase for Line instance
    line.GraphInfo.DashPhase = 1;
    // add line to shapes collection of drawing object
    canvas.Shapes.Add(line);
    // save PDF document
    doc.Save("c:/DashLineInBlack.pdf");
    
    //[VB.NET Code]
     
    ' instantiate Document instance
    Dim doc As Document = New Document()
    ' add page to pages collection of Document object
    Dim page As Page = doc.Pages.Add()
    ' create Drawing object with certain dimensions
    Dim canvas As Aspose.Pdf.Drawing.Graph = New Aspose.Pdf.Drawing.Graph(100, 400)
    ' add drawing object to paragraphs collection of page instance
    page.Paragraphs.Add(canvas)
    ' create Line object
    Dim line As Aspose.Pdf.Drawing.Line = New Aspose.Pdf.Drawing.Line(New Single() {100, 100, 200, 100})
    ' set color for Line object
    line.GraphInfo.Color = Aspose.Pdf.Color.Red
    ' specify dash array for line object
    line.GraphInfo.DashArray = New Integer() {0, 1, 0}
    ' set the dash phase for Line instance
    line.GraphInfo.DashPhase = 1
    ' add line to shapes collection of drawing object
    canvas.Shapes.Add(line)
    ' save PDF document
    doc.Save("c:/DashLineInBlack.pdf")
    
    

    public by sherazam  184673  0  5  0

    How to Render an Image of 3D Model from the Camera inside .NET Application

    This Technical tip explains how .NET developers can render an image of 3D model from the camera inside their .NET applications. Using Aspose.3D for .NET, developers can render an image to view a realistic image of 3D model, with or without the enhanced background, textures, shadows and also adjust the image size. The Render method exposed by the Sc
    // Enter here the actual content of the snippet.            // this code example creates a camera in a 3D scene, sets its target and render an image.
    
    // [C# Code Sample]
    
    // For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET
    // The path to the documents directory.
    string MyDir = RunExamples.GetDataDir();
    
    // Load scene from file
    Scene scene = new Scene(MyDir + "camera.3ds");
    // Create a camera at (10,10,10) and look at the origin point for rendering,
    // it must be attached to the scene before render
    Camera camera = new Camera();
    scene.RootNode.CreateChildNode("camera", camera);
    camera.ParentNode.Transform.Translation = new Vector3(10, 10, 10);
    camera.LookAt = Vector3.Origin;
    
    // Specify the image render option
    ImageRenderOptions opt = new ImageRenderOptions();
    // Set the background color
    opt.BackgroundColor = Color.AliceBlue;
    // Tells renderer where the it can find textures
    opt.AssetDirectories.Add(MyDir + "textures");
    // Turn on shadow
    opt.EnableShadows = true;
    // Render the scene in given camera's perspective into specified png file with size 1024x1024
    scene.Render(camera, MyDir + "Render3DModelImageFromCamera_out_.png", new Size(1024, 1024), ImageFormat.Png, opt);
    
    //[VB.NET Code Sample]
    
    ' For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET
    ' The path to the documents directory.
    Dim MyDir As String = RunExamples.GetDataDir()
    
    ' Load scene from file
    Dim scene As New Scene(MyDir & Convert.ToString("camera.3ds"))
    ' Create a camera at (10,10,10) and look at the origin point for rendering,
    ' it must be attached to the scene before render
    Dim camera As New Camera()
    scene.RootNode.CreateChildNode("camera", camera)
    camera.ParentNode.Transform.Translation = New Vector3(10, 10, 10)
    camera.LookAt = Vector3.Origin
    
    ' Specify the image render option
    Dim opt As New ImageRenderOptions()
    ' Set the background color
    opt.BackgroundColor = Color.AliceBlue
    ' Tells renderer where the it can find textures
    opt.AssetDirectories.Add(MyDir & Convert.ToString("textures"))
    ' Turn on shadow
    opt.EnableShadows = True
    ' Render the scene in given camera's perspective into specified png file with size 1024x1024
    scene.Render(camera, MyDir & Convert.ToString("Render3DModelImageFromCamera_out_.png"), New Size(1024, 1024), ImageFormat.Png, opt)
    

    public by sherazam  4272  3  5  0

    How to Crop EMF Image using Shifts or Rectangle Approaches in .NET Applications

    This technical tip explains how .NET developers can Crop an EMF Image inside their .NET applications. Image cropping usually refers to the removal of the outer parts of an image to help improve the framing. Cropping may also be used to cut out some portion of an image to increase the focus on a particular area. Aspose.Imaging for .Net API supports
    // Enter here the actual content of the snippet.            // Cropping by Shifts
    
    //[C# Code Sample]
    
    // create an instance of Rasterization options
    EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
    
    // create an instance of PNG options
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions;
    
    //Declare variables to store file paths for input and output images
    string filePath = @"TestEmfBezier.emf";
    string outPath = filePath + ".pdf";
    
    //Load an existing image into an instance of EMF class
    using (Aspose.Imaging.FileFormats.Emf.EmfImage image = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(filePath))
    {
      using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
      {
        //Based on the shift values, apply the cropping on image
        //Crop method will shift the image bounds toward the center of image
        image.Crop(30, 40, 50, 60);
    
        // Set height and width
        pdfOptions.VectorRasterizationOptions.PageWidth = image.Width;
        pdfOptions.VectorRasterizationOptions.PageHeight = image.Height;
    
        //Save the results to disk
        image.Save(outputStream, pdfOptions);
      }
    }
     
    //[VB.NET Code Sample]
    
    ' create an instance of Rasterization options
    Dim emfRasterizationOptions As New EmfRasterizationOptions()
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke
    
    ' create an instance of PNG options
    Dim pdfOptions As New PdfOptions()
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions
    
    'Declare variables to store file paths for input and output images
    Dim filePath As String = "TestEmfBezier.emf"
    Dim outPath As String = filePath & Convert.ToString(".pdf")
    
    'Load an existing image into an instance of EMF class
    Using image As Aspose.Imaging.FileFormats.Emf.EmfImage = DirectCast(Aspose.Imaging.Image.Load(filePath), Aspose.Imaging.FileFormats.Emf.EmfImage)
    	Using outputStream As New FileStream(outPath, FileMode.Create)
    		'Based on the shift values, apply the cropping on image
    		'Crop method will shift the image bounds toward the center of image
    		image.Crop(30, 40, 50, 60)
    
    		' Set height and width
    		pdfOptions.VectorRasterizationOptions.PageWidth = image.Width
    		pdfOptions.VectorRasterizationOptions.PageHeight = image.Height
    
    		'Save the results to disk
    		image.Save(outputStream, pdfOptions)
    	End Using
    End Using
    
    // Cropping by Rectangle
    
    //[C# Code Sample]
    
    // create an instance of Rasterization options
    EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
    
    // create an instance of PNG options
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions;
    
    //Declare variables to store file paths for input and output images
    string filePath = @"TestEmfExtPen.emf";
    string outPath = filePath + ".pdf";
    
    //Load an existing image into an instance of EMF class
    using (Aspose.Imaging.FileFormats.Emf.EmfImage image = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(filePath))
    {
        using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
        {
            //Create an instance of Rectangle class with desired size
            //Perform the crop operation on object of Rectangle class
            image.Crop(new Aspose.Imaging.Rectangle(30, 50, 100, 150));
    
            // Set height and width
            pdfOptions.VectorRasterizationOptions.PageWidth = image.Width;
            pdfOptions.VectorRasterizationOptions.PageHeight = image.Height;
    
            //Save the results to disk
            image.Save(outputStream, pdfOptions);
        }
    }
    
    //[VB.NET Code Sample]
    
    ' create an instance of Rasterization options
    Dim emfRasterizationOptions As New EmfRasterizationOptions()
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke
    
    ' create an instance of PNG options
    Dim pdfOptions As New PdfOptions()
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions
    
    'Declare variables to store file paths for input and output images
    Dim filePath As String = "TestEmfExtPen.emf"
    Dim outPath As String = filePath & Convert.ToString(".pdf")
    
    'Load an existing image into an instance of EMF class
    Using image As Aspose.Imaging.FileFormats.Emf.EmfImage = DirectCast(Aspose.Imaging.Image.Load(filePath), Aspose.Imaging.FileFormats.Emf.EmfImage)
    	Using outputStream As New FileStream(outPath, FileMode.Create)
    		'Create an instance of Rectangle class with desired size
    		'Perform the crop operation on object of Rectangle class
    		image.Crop(New Aspose.Imaging.Rectangle(30, 50, 100, 150))
    
    		' Set height and width
    		pdfOptions.VectorRasterizationOptions.PageWidth = image.Width
    		pdfOptions.VectorRasterizationOptions.PageHeight = image.Height
    
    		'Save the results to disk
    		image.Save(outputStream, pdfOptions)
    	End Using
    End Using
    
    

    public by sherazam  2876  3  5  0

    How to Convert PDF Pages to TIFF Image inside .NET Applications

    This technical tip shows how to convert PDF pages to TIFF image inside .NET Applications. The TiffDevice class allows you to convert PDF pages to TIFF images. This class provides a method named Process which allows you to convert all the pages in a PDF file to a single TIFF image. To convert a particular page in a PDF file to a TIFF image, use an
    // Enter here the actual content of the snippet.            
    //The following code snippet shows how to convert all the PDF pages to a single TIFF image.
    
    //[C# Code Sample]
     
    
    // Open document
    Document pdfDocument = new Document("input.pdf");
    
    // Create Resolution object
    Resolution resolution = new Resolution(300);
    
    // Create TiffSettings object
    TiffSettings tiffSettings = new TiffSettings();
    tiffSettings.Compression = CompressionType.None;
    tiffSettings.Depth = ColorDepth.Default;
    tiffSettings.Shape = ShapeType.Landscape;
    tiffSettings.SkipBlankPages = false;
    
    // Create TIFF device
    TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
    
    // Convert a particular page and save the image to stream
    tiffDevice.Process(pdfDocument, "output.tif");
    
    //[VB.NET Code Sample]
     
    
    'Open document
    Dim pdfDocument As New Document("input.pdf")
    
    'Create Resolution object
    Dim resolution As New Resolution(300)
    
    'Create TiffSettings object
    Dim tiffSettings As New TiffSettings()
    tiffSettings.Compression = CompressionType.None
    tiffSettings.Depth = ColorDepth.Default
    tiffSettings.Shape = ShapeType.Landscape
    tiffSettings.SkipBlankPages = False
    
    'Create TIFF device
    Dim tiffDevice As New TiffDevice(resolution, tiffSettings)
    
    'Convert a particular page and save the image to stream
    tiffDevice.Process(pdfDocument, "output.tif")
    
    
    //Convert One Page to TIFF Image
    
    //[C# Code Sample]
     
    
    // Open document
    Document pdfDocument = new Document("input.pdf");
    
    // Create Resolution object
    Resolution resolution = new Resolution(300);
    
    // Create TiffSettings object
    TiffSettings tiffSettings = new TiffSettings();
    tiffSettings.Compression = CompressionType.None;
    tiffSettings.Depth = ColorDepth.Default;
    tiffSettings.Shape = ShapeType.Landscape;
    tiffSettings.SkipBlankPages = false;
    
    // Create TIFF device
    TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
    
    
    // Convert a particular page and save the image to stream
    tiffDevice.Process(pdfDocument, 1, 1, "output.tif");
    
    
    //[VB.NET Code Sample]
     
    
    'Open document
    Dim pdfDocument As New Document("input.pdf")
    
    'Create Resolution object
    Dim resolution As New Resolution(300)
    
    'Create TiffSettings object
    Dim tiffSettings As New TiffSettings()
    tiffSettings.Compression = CompressionType.None
    tiffSettings.Depth = ColorDepth.Default
    tiffSettings.Shape = ShapeType.Landscape
    tiffSettings.SkipBlankPages = False
    
    'Create TIFF device
    Dim tiffDevice As New TiffDevice(resolution, tiffSettings)
    
    'Convert a particular page and save the image to stream
    tiffDevice.Process(pdfDocument, 1, 1, "output.tif")
    
    //Use Bradley algorithm during conversion
    
    //[C# Code Sample]
     
    
    string outputImageFile = @"c:\resultant.tif";
    string outputBinImageFile = @"c:\37116-bin.tif";
    //open document
    Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@"c:\input.pdf");
    //create Resolution object
    Resolution resolution = new Resolution(300);
    //create TiffSettings object
    TiffSettings tiffSettings = new TiffSettings();
    tiffSettings.Compression = CompressionType.LZW;
    tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
    //create TIFF device
    TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
    //convert a particular page and save the image to stream
    tiffDevice.Process(pdfDocument, outputImageFile);
    
    using (FileStream inStream = new FileStream(outputImageFile, FileMode.Open))
    {
           using (FileStream outStream = new FileStream(outputBinImageFile, FileMode.Create))
           {
                  tiffDevice.BinarizeBradley(inStream, outStream, 0.1);
           }
    }
    
    //[VB.NET Code Sample]
     
    
    Dim outputImageFile As String = "c:\resultant.tif"
    Dim outputBinImageFile As String = "c:\37116-bin.tif"
    'open document
    Dim pdfDocument As Aspose.Pdf.Document = New Aspose.Pdf.Document("c:\input.pdf")
    'create Resolution object
    Dim resolution As Aspose.Pdf.Devices.Resolution = New Aspose.Pdf.Devices.Resolution(300)
    'create TiffSettings object
    Dim tiffSettings As TiffSettings = New TiffSettings()
    tiffSettings.Compression = CompressionType.LZW
    tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp
    'create TIFF device
    Dim tiffDevice As TiffDevice = New TiffDevice(resolution, tiffSettings)
    'convert a particular page and save the image to stream
    tiffDevice.Process(pdfDocument, outputImageFile)
    
    Using inStream As FileStream = New FileStream(outputImageFile, FileMode.Open)
    
        Using outStream As FileStream = New FileStream(outputBinImageFile, FileMode.Create)
            tiffDevice.BinarizeBradley(inStream, outStream, 0.1)
        End Using
    End Using
    
    

    public by sherazam  3260  2  5  1

    How to Copy Message from One Mailbox Folder to Another in .NET Apps

    This technical tip explains how .NET developers can Copy Message from one Mailbox folder to another. Aspose.Email API provides the capability to copy message from one mailbox folder to another. It allows copying a single as well as multiple messages using the CopyMessage and CopyMessages methods. The CopyMessages method provides the capability to c
    // Enter here the actual content of the snippet.     //Copying Multiple Messages From One Folder to Another
    
    //[C# Code Sample]
    
    using (ImapClient client = new ImapClient("exchange.aspose.com", "username", "password" ))
    {
        //create the destination folder
        string folderName = "EMAILNET-35242";
        if (!client.ExistFolder(folderName))
            client.CreateFolder(folderName);
    
        try
        {
            //Append a couple of messages to the server
            MailMessage message1 = new MailMessage(
                "asposeemail.test3@aspose.com",
                "asposeemail.test3@aspose.com",
                "EMAILNET-35242 - " + Guid.NewGuid().ToString(),
                "EMAILNET-35242 Improvement of copy method.Add ability to 'copy' multiple messages per invocation.");
            string uniqueId1 = client.AppendMessage(message1);
    
            MailMessage message2 = new MailMessage(
                "asposeemail.test3@aspose.com",
                "asposeemail.test3@aspose.com",
                "EMAILNET-35242 - " + Guid.NewGuid().ToString(),
                "EMAILNET-35242 Improvement of copy method.Add ability to 'copy' multiple messages per invocation.");
            string uniqueId2 = client.AppendMessage(message2);
    
            //verify that the messages have been added to the mailbox
            client.SelectFolder(ImapFolderInfo.InBox);
            ImapMessageInfoCollection msgsColl = client.ListMessages();
            foreach (ImapMessageInfo msgInfo in msgsColl)
                Console.WriteLine(msgInfo.Subject);
    
            //copy multiple messages using hte CopyMessages command
            client.CopyMessages(new string[] { uniqueId1, uniqueId2 }, folderName, true);
    
            //Verify that messages are copied to the destination folder
            client.SelectFolder(folderName);
            msgsColl = client.ListMessages();
            foreach (ImapMessageInfo msgInfo in msgsColl)
                Console.WriteLine(msgInfo.Subject);
        }
        finally
        {
            try {
                client.DeleteFolder(folderName);
            }
            catch { }
        }
    }
     
    //[VB.NET Code Sample]
    
    Using client As New ImapClient("exchange.aspose.com", "username", "password")
    	'create the destination folder
    	Dim folderName As String = "EMAILNET-35242"
    	If Not client.ExistFolder(folderName) Then
    		client.CreateFolder(folderName)
    	End If
    
    	Try
    		'Append a couple of messages to the server
    		Dim message1 As New MailMessage("asposeemail.test3@aspose.com", "asposeemail.test3@aspose.com", "EMAILNET-35242 - " + Guid.NewGuid().ToString(), "EMAILNET-35242 Improvement of copy method.Add ability to 'copy' multiple messages per invocation.")
    		Dim uniqueId1 As String = client.AppendMessage(message1)
    
    		Dim message2 As New MailMessage("asposeemail.test3@aspose.com", "asposeemail.test3@aspose.com", "EMAILNET-35242 - " + Guid.NewGuid().ToString(), "EMAILNET-35242 Improvement of copy method.Add ability to 'copy' multiple messages per invocation.")
    		Dim uniqueId2 As String = client.AppendMessage(message2)
    
    		'verify that the messages have been added to the mailbox
    		client.SelectFolder(ImapFolderInfo.InBox)
    		Dim msgsColl As ImapMessageInfoCollection = client.ListMessages()
    		For Each msgInfo As ImapMessageInfo In msgsColl
    			Console.WriteLine(msgInfo.Subject)
    		Next
    
    		'copy multiple messages using hte CopyMessages command
    		client.CopyMessages(New String() {uniqueId1, uniqueId2}, folderName, True)
    
    		'Verify that messages are copied to the destination folder
    		client.SelectFolder(folderName)
    		msgsColl = client.ListMessages()
    		For Each msgInfo As ImapMessageInfo In msgsColl
    			Console.WriteLine(msgInfo.Subject)
    		Next
    	Finally
    		Try
    			client.DeleteFolder(folderName)
    		Catch
    		End Try
    	End Try
    End Using
    
           

    public by sherazam  182336  1  5  0

    How to Delete Messages in Bulk or One by One from Outlook PST in .NET Apps

    This technical tip explains how .NET developers can Delete Messages from outlook PST. Add Messages to PST Files showed how to add messages to PST files. It is, of course, also possible to delete items (contents) from a PST file and it may also be desirable to delete messages in bulk. Items from a PST file can be deleted using the FolderInfo.DeleteC
    // Enter here the actual content of the snippet.            
    //Deleting Messages from PST Files
    
    //The code snippets below delete messages from a PST file's Sent subfolder.
    
    //[C# Code Sample]
    
    // Get the Sent items folder
    FolderInfo folderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems);
    MessageInfoCollection msgInfoColl = folderInfo.GetContents();
    foreach (MessageInfo msgInfo in msgInfoColl)
    {
        Console.WriteLine(msgInfo.Subject + ": " + msgInfo.EntryIdString);
        if (msgInfo.Subject.Equals("some delete condition") == true)
        {
            // Delete this item
            folderInfo.DeleteChildItem(msgInfo.EntryId);
            Console.WriteLine("Deleted this message");
        }
    }
     
    //[VB.NET Code Sample]
    
    ' Get the Sent items folder
    Dim folderInfo As FolderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems)
    Dim msgInfoColl As MessageInfoCollection = folderInfo.GetContents()
    For Each msgInfo As MessageInfo In msgInfoColl
    	Console.WriteLine(msgInfo.Subject & ": " & msgInfo.EntryIdString)
    	If msgInfo.Subject.Equals("some delete condition") = True Then
    		' Delete this item
    		folderInfo.DeleteChildItem(msgInfo.EntryId)
    		Console.WriteLine("Deleted this message")
    	End If
    Next msgInfo
    
    //Delete Items in Bulk from PST File
    
    //Aspose.Email API can be used to delete items in bulk from a PST file. This is achieved using the DeleteChildItems method which accepts a list of Entry ID items referring to the items to be deleted.
    
    //[C# Code Sample]
    
    using (PersonalStorage pst = PersonalStorage.FromFile(@"test.pst"))
    {
        FolderInfo inbox = pst.RootFolder.GetSubFolder("Inbox");
        
        // find messages having From = "someuser@domain.com" 
        PersonalStorageQueryBuilder queryBuilder = new PersonalStorageQueryBuilder();
        queryBuilder.From.Contains("someuser@domain.com");
        MessageInfoCollection messages = inbox.GetContents(queryBuilder.GetQuery());
        IList<string> deleteList = new List<string>();
        foreach (MessageInfo messageInfo in messages)
        {
            deleteList.Add(messageInfo.EntryIdString);
        }
        
        // delete messages having From = "someuser@domain.com"
        inbox.DeleteChildItems(deleteList);
    }
    
    //[VB.NET Code Sample]
    
    Using pst As PersonalStorage = PersonalStorage.FromFile("test.pst")
    	Dim inbox As FolderInfo = pst.RootFolder.GetSubFolder("Inbox")
    
    	' find messages having From = "someuser@domain.com" 
    	Dim queryBuilder As New PersonalStorageQueryBuilder()
    	queryBuilder.From.Contains("someuser@domain.com")
    	Dim messages As MessageInfoCollection = inbox.GetContents(queryBuilder.GetQuery())
    	Dim deleteList As IList(Of String) = New List(Of String)()
    	For Each messageInfo As MessageInfo In messages
    		deleteList.Add(messageInfo.EntryIdString)
    	Next
    
    	' delete messages having From = "someuser@domain.com"
    	inbox.DeleteChildItems(deleteList)
    End Using
    
    

    public by sherazam  2711  0  5  1

    How to Copy Paragraph & Portion of Text in PPTX Presentation inside .NET Apps

    This technical tip explains how .NET developers to copy paragraph & portion of text in PPTX presentation using Aspose.Slides inside their .NET applications. In order to format presentation text we need to format that on Paragraph and Portion level. There are some text properties that can be set on Paragraph level and some are set on Portion level.
    // Enter here the actual content of the snippet.            //Copying a Paragraph
    
    //[C# Code Sample]
     
    //Function Call
    IParagraph newPara=CopyParagraph(SourcePara);
    
    //Function Definition//Function Definition
    public static IParagraph CopyParagraph(IParagraph par)
    {
        Paragraph temp = new Paragraph();
        // use CreateParagraphFormatData !!!
        IParagraphFormatEffectiveData paraData = par.CreateParagraphFormatEffective();
        // use ParagraphFormat  to set values
        temp.ParagraphFormat.Alignment = paraData.Alignment;
        temp.ParagraphFormat.DefaultTabSize = paraData.DefaultTabSize;
        temp.ParagraphFormat.MarginLeft = paraData.MarginLeft;
        temp.ParagraphFormat.MarginRight = paraData.MarginRight;
        temp.ParagraphFormat.FontAlignment = paraData.FontAlignment;
        temp.ParagraphFormat.Indent = paraData.Indent;
        temp.ParagraphFormat.Depth = paraData.Depth;
        temp.ParagraphFormat.SpaceAfter = paraData.SpaceAfter;
        temp.ParagraphFormat.SpaceBefore = paraData.SpaceBefore;
        temp.ParagraphFormat.SpaceWithin = paraData.SpaceWithin;
    
        temp.ParagraphFormat.Bullet.Type = paraData.Bullet.Type;
        temp.ParagraphFormat.Bullet.Char = paraData.Bullet.Char;
        temp.ParagraphFormat.Bullet.Color.Color = paraData.Bullet.Color;
        temp.ParagraphFormat.Bullet.Height = paraData.Bullet.Height;
        temp.ParagraphFormat.Bullet.Font = paraData.Bullet.Font;
        temp.ParagraphFormat.Bullet.NumberedBulletStyle = paraData.Bullet.NumberedBulletStyle;
        temp.ParagraphFormat.FontAlignment = paraData.FontAlignment;
    
    
        temp.ParagraphFormat.RightToLeft = paraData.RightToLeft ? NullableBool.True : NullableBool.False;
        temp.ParagraphFormat.EastAsianLineBreak = paraData.EastAsianLineBreak ? NullableBool.True : NullableBool.False;
        temp.ParagraphFormat.HangingPunctuation = paraData.HangingPunctuation ? NullableBool.True : NullableBool.False;
    
        return temp;
    }
    
    public static Paragraph CopyParagraph(Paragraph par)
     
    //[VB.NET Code Sample]
     
    'Function Call
    Dim newPara As IParagraph=CopyParagraph(SourcePara)
    
    
    'Function Definition
    Public Shared Function CopyParagraph(ByVal par As IParagraph) As IParagraph
    	Dim temp As New Paragraph()
    
    	' use CreateParagraphFormatData !!!
    	Dim paraData As IParagraphFormatEffectiveData = par.CreateParagraphFormatEffective()
    	' use ParagraphFormat  to set values
    	temp.ParagraphFormat.Alignment = paraData.Alignment
    	temp.ParagraphFormat.DefaultTabSize = paraData.DefaultTabSize
    	temp.ParagraphFormat.MarginLeft = paraData.MarginLeft
    	temp.ParagraphFormat.MarginRight = paraData.MarginRight
    	temp.ParagraphFormat.FontAlignment = paraData.FontAlignment
    	temp.ParagraphFormat.Indent = paraData.Indent
    	temp.ParagraphFormat.Depth = paraData.Depth
    	temp.ParagraphFormat.SpaceAfter = paraData.SpaceAfter
    	temp.ParagraphFormat.SpaceBefore = paraData.SpaceBefore
    	temp.ParagraphFormat.SpaceWithin = paraData.SpaceWithin
    
    	temp.ParagraphFormat.Bullet.Type = paraData.Bullet.Type
    	temp.ParagraphFormat.Bullet.Char = paraData.Bullet.Char
    	temp.ParagraphFormat.Bullet.Color.Color = paraData.Bullet.Color
    	temp.ParagraphFormat.Bullet.Height = paraData.Bullet.Height
    	temp.ParagraphFormat.Bullet.Font = paraData.Bullet.Font
    	temp.ParagraphFormat.Bullet.NumberedBulletStyle = paraData.Bullet.NumberedBulletStyle
    	temp.ParagraphFormat.FontAlignment = paraData.FontAlignment
    
    
    	temp.ParagraphFormat.RightToLeft = If(paraData.RightToLeft, NullableBool.True, NullableBool.False)
    	temp.ParagraphFormat.EastAsianLineBreak = If(paraData.EastAsianLineBreak, NullableBool.True, NullableBool.False)
    	temp.ParagraphFormat.HangingPunctuation = If(paraData.HangingPunctuation, NullableBool.True, NullableBool.False)
    
    	Return temp
    End Function
    
    //Copying a PortionEx
    
    // In the following example, the CopyPortion method is shared that takes portion to be copied as an argument. It copies all the properties of source portion to a temporary portion and return the same. The target portion gets the copied values.
    
    //[C# Code Sample]
     
    //Function Call
     IPortion newPortion=CopyPortion(SourcePortion);
    
    //Function Definition
     public static IPortion CopyPortion(IPortion por)
     {
         Portion temp = new Portion();
    
         //use CreatePortionFormatData!!!
         IPortionFormatEffectiveData portData = por.CreatePortionFormatEffective();
    
         // use PortionFormat to set values
         temp.PortionFormat.AlternativeLanguageId = portData.AlternativeLanguageId;
         temp.PortionFormat.BookmarkId = portData.BookmarkId;
         temp.PortionFormat.Escapement = portData.Escapement;
         temp.PortionFormat.FillFormat.FillType = por.PortionFormat.FillFormat.FillType;
         temp.PortionFormat.FillFormat.SolidFillColor.Color = portData.FillFormat.SolidFillColor;
    
         temp.PortionFormat.FontBold = portData.FontBold ? NullableBool.True : NullableBool.False;
         temp.PortionFormat.FontHeight = portData.FontHeight;
         temp.PortionFormat.FontItalic = portData.FontItalic ? NullableBool.True : NullableBool.False;
         temp.PortionFormat.FontUnderline = portData.FontUnderline;
         temp.PortionFormat.UnderlineFillFormat.FillType = portData.UnderlineFillFormat.FillType;
         temp.PortionFormat.UnderlineFillFormat.SolidFillColor.Color = portData.UnderlineFillFormat.SolidFillColor;
         temp.PortionFormat.IsHardUnderlineFill = portData.IsHardUnderlineFill ? NullableBool.True : NullableBool.False;
         temp.PortionFormat.IsHardUnderlineLine = portData.IsHardUnderlineLine ? NullableBool.True : NullableBool.False;
    
         temp.PortionFormat.KerningMinimalSize = portData.KerningMinimalSize;
         temp.PortionFormat.Kumimoji = portData.Kumimoji ? NullableBool.True : NullableBool.False;
         temp.PortionFormat.LanguageId = portData.LanguageId;
    
         temp.PortionFormat.LatinFont = portData.LatinFont;
         temp.PortionFormat.EastAsianFont = portData.EastAsianFont;
         temp.PortionFormat.ComplexScriptFont = portData.ComplexScriptFont;
         temp.PortionFormat.SymbolFont = portData.SymbolFont;
    
         temp.PortionFormat.TextCapType = portData.TextCapType;
         temp.PortionFormat.Spacing = portData.Spacing;
         temp.PortionFormat.StrikethroughType = portData.StrikethroughType;
         temp.PortionFormat.ProofDisabled = portData.ProofDisabled ? NullableBool.True : NullableBool.False;
         temp.PortionFormat.NormaliseHeight = portData.NormaliseHeight ? NullableBool.True : NullableBool.False;
         temp.PortionFormat.HyperlinkMouseOver = portData.HyperlinkMouseOver;
         temp.PortionFormat.HyperlinkClick = por.PortionFormat.HyperlinkClick;
         temp.PortionFormat.HighlightColor.Color = portData.HighlightColor;
    
    
         return temp;
     }
     
    //[VB.NET Code Sample]
     
    'Function Call
     Private newPortion As IPortion=CopyPortion(SourcePortion)
    
    'Function Definition
     Public Shared Function CopyPortion(ByVal por As IPortion) As IPortion
    	 Dim temp As New Portion()
    
    	 'use CreatePortionFormatData!!!
    	 Dim portData As IPortionFormatEffectiveData = por.CreatePortionFormatEffective()
    
    	 ' use PortionFormat to set values
    	 temp.PortionFormat.AlternativeLanguageId = portData.AlternativeLanguageId
    	 temp.PortionFormat.BookmarkId = portData.BookmarkId
    	 temp.PortionFormat.Escapement = portData.Escapement
    	 temp.PortionFormat.FillFormat.FillType = por.PortionFormat.FillFormat.FillType
    	 temp.PortionFormat.FillFormat.SolidFillColor.Color = portData.FillFormat.SolidFillColor
    
    	 temp.PortionFormat.FontBold = If(portData.FontBold, NullableBool.True, NullableBool.False)
    	 temp.PortionFormat.FontHeight = portData.FontHeight
    	 temp.PortionFormat.FontItalic = If(portData.FontItalic, NullableBool.True, NullableBool.False)
    	 temp.PortionFormat.FontUnderline = portData.FontUnderline
    	 temp.PortionFormat.UnderlineFillFormat.FillType = portData.UnderlineFillFormat.FillType
    	 temp.PortionFormat.UnderlineFillFormat.SolidFillColor.Color = portData.UnderlineFillFormat.SolidFillColor
    	 temp.PortionFormat.IsHardUnderlineFill = If(portData.IsHardUnderlineFill, NullableBool.True, NullableBool.False)
    	 temp.PortionFormat.IsHardUnderlineLine = If(portData.IsHardUnderlineLine, NullableBool.True, NullableBool.False)
    
    	 temp.PortionFormat.KerningMinimalSize = portData.KerningMinimalSize
    	 temp.PortionFormat.Kumimoji = If(portData.Kumimoji, NullableBool.True, NullableBool.False)
    	 temp.PortionFormat.LanguageId = portData.LanguageId
    
    	 temp.PortionFormat.LatinFont = portData.LatinFont
    	 temp.PortionFormat.EastAsianFont = portData.EastAsianFont
    	 temp.PortionFormat.ComplexScriptFont = portData.ComplexScriptFont
    	 temp.PortionFormat.SymbolFont = portData.SymbolFont
    
    	 temp.PortionFormat.TextCapType = portData.TextCapType
    	 temp.PortionFormat.Spacing = portData.Spacing
    	 temp.PortionFormat.StrikethroughType = portData.StrikethroughType
    	 temp.PortionFormat.ProofDisabled = If(portData.ProofDisabled, NullableBool.True, NullableBool.False)
    	 temp.PortionFormat.NormaliseHeight = If(portData.NormaliseHeight, NullableBool.True, NullableBool.False)
    	 temp.PortionFormat.HyperlinkMouseOver = portData.HyperlinkMouseOver
    	 temp.PortionFormat.HyperlinkClick = por.PortionFormat.HyperlinkClick
    	 temp.PortionFormat.HighlightColor.Color = portData.HighlightColor
    
    	 Return temp
     End Function
    

    public by sherazam  2694  8  5  0

    How to Convert Large Text Files to PDF inside .NET Applications

    This technical tip shows how to convert a text file to PDF inside .NET applications. We are often asked if we can quickly provide some code which can accomplish this task and save them the effort of going through the documentation. So for the benefit of everyone, we present here a simple example which can be used as it is to easily and efficiently
    // Enter here the actual content of the snippet.            
    //Please take a look over the following code snippet for converting a text file to PDF
    
    //[C# Code Sample]
     
    
    //read the source text file
    System.IO.TextReader tr = new StreamReader("test.txt");
    
    //Instantiate Pdf pbject by calling its empty constructor
    Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
    
    //Create a new section in the Pdf object
    Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
    
    //Create a new text paragraph and pass the text to its constructor as argument
    Aspose.Pdf.Generator.Text t2 = new Aspose.Pdf.Generator.Text(tr.ReadToEnd());
    sec1.Paragraphs.Add(t2);
    
    pdf1.Save("test.Pdf");
    
    //[VB.NET Code Sample]
     
    
    Dim tr As System.IO.TextReader = New StreamReader("test.txt")
    
    'Instantiate Pdf pbject by calling its empty constructor
    Dim pdf1 As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()
    
    'Create a new section in the Pdf object
    Dim sec1 As Aspose.Pdf.Generator.Section = pdf1.Sections.Add()
    
    'Create a new text paragraph and pass the text to its constructor as argument
    Dim t2 As Aspose.Pdf.Generator.Text = New Aspose.Pdf.Generator.Text(tr.ReadToEnd())
    
    sec1.Paragraphs.Add(t2)
    
    pdf1.Save("test.Pdf")
    
    //Converting Large Text files to PDF
    
    //[C# Code Sample]
     
    
    //Instantiate Pdf pbject by calling its empty constructor
    Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
    //Create a new section in the Pdf object
    Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
    
    //Specify the location of input text file
    String FILE_NAME = "d:/pdftest/LargeText.txt";
    
    if (File.Exists(FILE_NAME))
       {
           
        System.IO.TextReader objReader =  new System.IO.StreamReader(FILE_NAME);
        // Read the file till the end of the file has come
        do 
        {
         //Create a new text paragraph & pass text to its constructor as argument
         Aspose.Pdf.Generator.Text t2 = new Aspose.Pdf.Generator.Text(objReader.ReadLine());
         // add the text object to paragraphs collection of section
         sec1.Paragraphs.Add(t2);
    
         // Read till the end of file
         }while(objReader.Peek() != -1);
    
       // Close the StreamReader object
       objReader.Close();
       }
       else
       MessageBox.Show("File Does Not Exist");
        
    // Save the PDF file
    pdf1.Save("d:/pdftest/large_textfile.pdf");
    
    //[VB.NET Code Sample]
     
    
    'Instantiate Pdf pbject by calling its empty constructor
    Dim pdf1 As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()
    
    'Create a new section in the Pdf object
    Dim sec1 As Aspose.Pdf.Generator.Section = pdf1.Sections.Add()
    
    ' Specify the location of input text file
    Dim FILE_NAME As String = "d:/pdftest/LargeText.txt"
    
    If System.IO.File.Exists(FILE_NAME) = True Then
    
        Dim objReader As New System.IO.StreamReader(FILE_NAME)
        ' Read the file till the end of the file has come
        Do While objReader.Peek() <> -1
            'Create a new text paragraph and pass text to its constructor as argument
            Dim t2 As Aspose.Pdf.Generator.Text = New Aspose.Pdf.Generator.Text(objReader.ReadLine())
            ' add the text object to paragraphs collection of section
            sec1.Paragraphs.Add(t2)
        Loop
        ' Close the StreamReader object
        objReader.Close()
    Else
        MsgBox("File Does Not Exist")
    End If
    
    ' Save the PDF file
    pdf1.Save("d:/pdftest/large_textfile.pdf")
    
    

    public by sherazam  4182  1  6  0

    How to Combine Two or Multiple Images into a Single Image inside .NET Apps

    This technical tip explains how .NET developers can combine single or multiple images inside their .NET applications. This example uses Graphics class and shows how to combine two or more images into a single complete image. To demonstrate the operation, the example creates a new Image canvas in JPEG format and draw images on the canvas surface us
    // Enter here the actual content of the snippet.            
    // Combining Images using Graphics Class
    
    //[C# Code Sample]
    
    //Create an instance of JpegOptions and set its various properties
    Aspose.Imaging.ImageOptions.JpegOptions ImageOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
    
    //Create an instance of FileCreateSource and assign it to Source property
    ImageOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"two_images_result.jpeg", false);
    
    //Create an instance of Image and define canvas size
    using (var image = Aspose.Imaging.Image.Create(ImageOptions, 600, 600))
    {
          //Create and initialize an instance of Graphics
          var graphics = new Aspose.Imaging.Graphics(image);
    
          //Clear the image surface with white color
          graphics.Clear(Aspose.Imaging.Color.White);
    
          // Draw Image
          graphics.DrawImage(Aspose.Imaging.Image.Load(@"input1.jpg"), 0, 0, 600, 300);
          graphics.DrawImage(Aspose.Imaging.Image.Load(@"input2.jpg"), 0, 300, 600, 300);
                    
          // Call save method to save the resultant image.
          image.Save();
    }
     
    //[VB.NET Code Sample]
    
    'Create an instance of JpegOptions and set its various properties
    Dim ImageOptions As New Aspose.Imaging.ImageOptions.JpegOptions()
    
    'Create an instance of FileCreateSource and assign it to Source property
    ImageOptions.Source = New Aspose.Imaging.Sources.FileCreateSource("two_images_result.jpeg", False)
    
    'Create an instance of Image and define canvas size
    Using image = Aspose.Imaging.Image.Create(ImageOptions, 600, 600)
    	'Create and initialize an instance of Graphics
    	Dim graphics = New Aspose.Imaging.Graphics(image)
    
    	'Clear the image surface with white color
    	graphics.Clear(Aspose.Imaging.Color.White)
    
    	' Draw Image
    	graphics.DrawImage(Aspose.Imaging.Image.Load("input1.jpg"), 0, 0, 600, 300)
    	graphics.DrawImage(Aspose.Imaging.Image.Load("input2.jpg"), 0, 300, 600, 300)
    
    	' Call save method to save the resultant image.
    	image.Save()
    End Using
    
    
    • Public Snippets
    • Channels Snippets