What's New in Document Solutions for Word v7
DsWord v7.2 - August 21, 2024
Hyperlink Properties for Shapes
You can now add the hyperlink properties HyperlinkOnClick and HyperlinkOnHover on shapes programmatically that add more interactivity to Word documents.
DsWord has added the HyperlinkOnAction class, which allows developers to add hyperlink properties to all shape classes (Picture, CanvasShape, GroupShape, InkShape, Shape). Specifying these properties also adds the “Edit Link/Open Link/Remove Link” commands to Microsoft Word’s context menu on the shape (except on ink shapes).
The following code adds Hyperlink properties to a Picture class using the new API additions.
v7.1 - April 17, 2024
Document Solutions for Word (DsWord)
Add Online Video in Word Documents
Integrating online videos into Word documents enhances dynamic visual elements, making complex concepts clearer. Additionally, it facilitates versatile content creation, promoting interactive and informative documentation for diverse purposes, from educational materials to business reports. DsWord presents the WebVideoProperties class, empowering users to customize the video player's HTML content and define its dimensions. This facilitates the seamless integration of online videos into Word documents, enabling direct playback within the document for a richer multimedia experience. The class offers the SetUrl method with three overloads, allowing users to specify the video's input URL, title, height, and width. This method generates the appropriate EmbeddedHTML string internally, providing a convenient way for users to define these parameters that may be challenging to write directly.
The following code adds an online video to the Word document:
var dsdoc = new GcWordDocument();
dsdoc.Load("wetlands.docx");
var pic = dsdoc.Body.Paragraphs[3].AddRun().AddPicture();
// Poster frame image.
byte[] imageBytes = File.ReadAllBytes("Wetlands.jpg");
pic.ImageData.SetImage(imageBytes, contentType: "image/jpeg");
pic.ImageData.WebVideoProperties.SetUrl("https://www.youtube.com/watch?v=k9UbKlBc3W4", "title", 60, 60);
v7 -December 13, 2023
Important Information: A Shift from ‘GrapeCity Documents’ to Document Solutions
In tandem with our commitment to continuous improvement, GrapeCity Documents has rebranded to Document Solutions. This change extends to the APIs and controls within the Document Solutions suite. Below, you'll find the updated nomenclature:
Document Solutions for Word (DsWord) previously GrapeCity Documents for Word (GcWord).
We've made it easy to upgrade your existing packages to the new packages using the Documents Migration tool. This tool is included in the trial Downloads zip file found on the above product links. For the v7.0 release cycle, packages with the previous product and/or company names will be provided separately, ensuring access to the same v7 new feature updates. This approach is designed to facilitate a seamless transition for users.
It's important to emphasize that despite the adoption of new package names, only the package names themselves are altered. The namespace and type names remain unchanged, eliminating the need for any modifications in your C#/VB user codes.
Picture Effects in Word .docx
In the ever-evolving landscape of document creation, the need for dynamic and visually appealing content is paramount. In response to the demand for versatile and customizable document elements, DsWord v7 introduces a robust set of features that allow users to apply a diverse range of effects to pictures. This expansion not only enhances the visual appeal of documents but also streamlines the process of incorporating Microsoft Word-supported pictures effects through code. Using these effects, you can perform following programmatically on images -
- Change picture brightness and contrast
- Recolor with preset
- Change image color
- Set transparent color
- Overlay a specific color tint onto a picture.
- and much more.
Following new API has been introduced -
- RecolorType enum - Specifies the type of an image color change.
- ImageEffectType enum - Specifies the image effect type.
- UserColor class - Represents an extended color.
- WebVideoProperties class - Represents the properties for displaying an online video to the user.
- ImageEffect class - Represents a base class for image effects.
- AlphaBiLevel class - Represents an Alpha bi-level effect.
- AlphaCeiling class - Represents an alpha ceiling effect.
- AlphaFloor class - Represents an alpha floor effect.
- AlphaInverse class - Represents an alpha inverse effect.
- AlphaModulation class - Represents an alpha modulate fixed effect.
- AlphaModulationComplex class - Represents an alpha modulate complex effect.
- AlphaReplace class - Represents an alpha replace effect.
- BiLevel class - Represents a bi-level (black/white) effect.
- ColorChange class - Represents a color change effect.
- ColorReplacement class - Represents a solid color replacement effect.
- Duotone class - Represents a duotone effect.
- Grayscale class - Represents a gray scale effect.
- HslEffect class - Represents a hue/saturation/luminance effect.
- Luminance class - Represents a luminance effect.
- Tint class - Represents a tint effect.
- ImageEffectList class - Represents list of image effects.
- EmbeddedImageData class - Represents the embedded image data.
- PicturePreset enum addition - Picture, slightly rotated counterclockwise, with white border.
New API additions and changes to -
- ImageData class
- Blur class
- FillOverlay class
In following example, an image is added to a Word document and is recolored to Grayscale using DsWord API’s Picture.ImageData.RecolorType enum.
Have a look on following resources to find more samples on applying the new effects on pictures.
New CanAdd.. methods in Content Objects, Section and Body Classes
In v7 release, you can also now use ‘CanAdd’ CanAdd(ContentObjectType) and CanAddContentControl(ContentControlType) for ContentObject, Section and Body classes to check whether a content object can be added to the end of another content object without raising an exception. It makes it easier to determine this earlier while coding with DsWord so that the process of adding content objects at the right locations becomes easy without causing errors later.
Example: Following code checks whether a string needs to be added to a RichText control as a paragraph or as a run.
var doc = new GcWordDocument();
var p = doc.Body.Paragraphs.Add();
var cc = p.AddContentControl(ContentControlType.RichText).Content;
if (cc.CanAdd(typeof(Paragraph))) // returns false since the content control was created on inline level
cc.AddParagraph("Rich text");
else
cc.AddRun("Rich text");