GithubHelp home page GithubHelp logo

evotecit / pswriteoffice Goto Github PK

View Code? Open in Web Editor NEW
90.0 6.0 5.0 13.03 MB

Experimental PowerShell Module to create and edit Microsoft Word, Microsoft Excel, and Microsoft PowerPoint documents without having Microsoft Office installed.

PowerShell 97.23% C# 2.77%
powershell powerpoint excel word office

pswriteoffice's Introduction

PSWriteOffice - PowerShell Module

PSWriteOffice is cross-platform PowerShell module for writing Microsoft Office documents (Word, Excel and later on PowerPoint). This module long term goal is to fully replace:

  • PSWriteWord - this module works only in Windows PowerShell 5.1, and DLL license has changed making updates to it very hard.
  • PSWriteExcel - this module worked cross-platform but DLL maintainer moved to pay project leaving the old DLL unmaintained.

While at this moment this module doesn't expose all DLL features, and some features are strictly available in by using their net methods, the goal is to expose it fully using PowerShell.

This module is built using following libraries:

  • Open XML SDK for .NET licensed MIT - Microsoft's library doing heavy lifting for all other Open XML projects.
  • ClosedXML licensed MIT - library for reading and writing Excel files.
  • HtmlToOpenXml licensed MIT - library for converting HTML to Word documents.
  • OfficeIMO - library for reading and writing Word and Excel files.
  • SixLabors.ImageSharp licensed Apache 2.0 - library for image processing.

pswriteoffice's People

Contributors

przemyslawklys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pswriteoffice's Issues

No Charts :(

I am waiting for possibility to create charts in this module

Add table to table cell

Is there a way to create a new table and add this table into a cell of a second, existing table?

Search and Replace Text

I would love to see the project to be able to search and replace text/hyperlinks in the a word document. This would be incredibly helpful.

Set font name

How to set font of document or paragraph?

I could change font size:

$doc.Settings.FontSize = 15
# or
$paragraph.FontSize = 15

However, I can't set the font itself. The settings below don't work:

$doc.Settings.FontFamily = 'Times New Roman'
# or
$paragraph.FontFamily = 'Times New Roman'

PieChart method

Hello Przemysław,

I have been struggling to use .AddPieChart and .AddChartPie to add a pie chart to Word doc output.

.AddPieChart seems to work OK in that my output doc lands up with a blank section that would be a pie, but whenever I try to use .AddChartPie I get an overload error.

Most basic example:

$PieChart = $DocumentTest.AddPieChart("Test Pie Chart", $true, 600, 300)

$PieChart.AddChartPie("Category1", 10)
$PieChart.AddChartPie("Category2", 20)
$PieChart.AddChartPie("Category3", 30)

Error:

Error: Cannot find an overload for "AddChartPie" and the argument count: "2".

I've tried making sure I'm using the expected types as defined below, but every variation seems to fail and results in the overload error.

[void] AddChartPie[T](
    [string] $name,
    [int[]] $values)

[void] AddChartPie[T](
    [string] $name,
    [List[T]] $values)

Can you offer any guidance or share an example?

Underline spaces/tabs

How to underline spaces or tabs? When I set

$p2 = New-OfficeWordText -Document $doc -Bold 1,0 -Underline 0,1 -Text `
"We are ","`t`tJohn Doe and Jane Doe`t`t" -ReturnObject

The result is
изображение

But I'd like to have
изображение

Set margins size

Hello, how to set margins?

I try

$doc.Margins.Left = 1

but it doesn't work.

Can I set margins preset like 'Narrow'?

Get-OfficeWord error - Exception calling "Load" with "3" argument(s): "This isn't implemented yet?"

Hello! I'm trying to read a simple .docx file which has been created in Onlyoffice and getting the following error:

WARNING: Get-OfficeWord - File C:\temp\hamlet.docx couldn't be open.
Error: Exception calling "Load" with "3" argument(s): "This isn't implemented yet?"

Is it critical to have only MS Word-created source documents and what is the problem in this case when there's nothing special in the .docx file?

Add Chart/Picture into Word Table Cell

There is practice for us to add Word chart / picture into a table cell, but I haven't found the way with this module or PSWriteWord. Looking forward to knowing the solution. Thank you.

Null array error when exporting to word

Hello,

If I have null array inside a script and export all the result into word file, I have an error about the null array and the file can't be opened with word because it's "corrupted".

Possible to add images?

Hello,

I noticed a method $Document.Images.Add, but not having any luck.

Tried specifying full and relative paths to a jpeg image but I always get error "InvalidOperation: You cannot call a method on a null-valued expression."

Am I doing it wrong, or this feature not yet implemented?

Close-OfficeWord unable to close an open worddoc without a valid WordDoc object being passed.

The syntax for Close-OfficeWord suggests that the -Document parameter is optional. That would lead one to believe that if they had done an Get-OfficeWord without assigning the output to a variable, that they could then simply execute Close-OfficeWord to close it again, but that doesn't appear to be the case.

Additionally, should one's script error before having a chance to close a previously opened document, that document is held in limbo until the PowerShell session is closed.

Add Line Breaks

Hi. What is the correct way to add a line break / new line? I didn't find anything in the examples.

New-WordImage

adding pictures to word would be cool and practical

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.