Skip to content

Commit

Permalink
Merge pull request #6 from dolanmiu/master
Browse files Browse the repository at this point in the history
Update from Dolan's master
  • Loading branch information
anti-the-social authored Sep 16, 2022
2 parents e0576c8 + 5d6d52a commit 601a403
Show file tree
Hide file tree
Showing 409 changed files with 3,360 additions and 1,098 deletions.
58 changes: 58 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// cSpell Settings
{
// Version of the setting file. Always 0.2
"version": "0.2",
// language - current active spelling language
"language": "en_US",
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
// words - list of words to be always considered correct
"words": [
"Xmlable",
"twip",
"twips",
"jsonify",
"falsey",
"aiueo",
"iroha",
"aiueo",
"iroha",
"chosung",
"Abjad",
"Initializable",
"rels",
"dolan",
"xmlify",
"Xmlifyed",
"xmlified",
"datas",
"jszip",
"rsid",
"NUMPAGES",
"ATLEAST",
"ooxml",
"clippy",
"docsify"
],
"ignoreRegExpList": [
"/\"w:.+\"/",
"/\"s:.+\"/",
"/\"a:.+\"/",
"/\"pic:.+\"/",
"/\"xmlns:.+\"/",
"/\"vt:.+\"/",
"/[^\\s]{40,}/",
"/<xsd:.+/>/",
"/[A-Z_]+ = \".+\"/",
"/XmlAttributeComponent<{[^}]+}>/g",
"/xmlKeys = {[^}]+}/g",
"/\\.to\\.deep\\.equal\\({[^)]+}\\)/g",
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
"/new [a-zA-Z]+\\({[^£]+}\\)/g"
],
"ignorePaths": ["package.json", "docs/api"],
"allowCompoundWords": true,
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
"flagWords": ["hte"]
}
10 changes: 10 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,13 @@ jobs:
run: npm ci --force
- name: Prettier
run: npm run style
cspell:
name: CSpell
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Install Dependencies
run: npm ci --force
- name: Prettier
run: npm run cspell
8 changes: 4 additions & 4 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"check-coverage": true,
"statements": 99.43,
"branches": 96.6,
"functions": 99.47,
"lines": 99.43,
"statements": 99.62,
"branches": 96.81,
"functions": 99.82,
"lines": 99.62,
"include": [
"src/**/*.ts"
],
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"streetsidesoftware.code-spell-checker"
]
}
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,37 @@

Here are examples of `docx` being used with basic `HTML/JS` in a browser environment:

* https://codepen.io/dolanmiu/pen/RwNeObg
* https://jsfiddle.net/dolanmiu/onadx1gu/
- https://codepen.io/dolanmiu/pen/RwNeObg
- https://jsfiddle.net/dolanmiu/onadx1gu/

Here is an example of `docx` working in `Angular`:

* https://stackblitz.com/edit/angular-docx
- https://stackblitz.com/edit/angular-docx

Here is an example of `docx` working in `React`:

* https://stackblitz.com/edit/react-docx
* https://stackblitz.com/edit/react-docx-images (adding images to Word Document)
- https://stackblitz.com/edit/react-docx
- https://stackblitz.com/edit/react-docx-images (adding images to Word Document)

Here is an example of `docx` working in `Vue.js`:

* https://stackblitz.com/edit/vuejs-docx
- https://stackblitz.com/edit/vuejs-docx

## Node

Press `endpoint` on the `RunKit` website:

![RunKit Instructions](https://user-images.githubusercontent.com/2917613/38582539-f84311b6-3d07-11e8-90db-5885ae02c3c4.png)

* https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text
* https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text
* https://runkit.com/dolanmiu/docx-demo3 - Bullet points
* https://runkit.com/dolanmiu/docx-demo4 - Simple table
* https://runkit.com/dolanmiu/docx-demo5 - Images
* https://runkit.com/dolanmiu/docx-demo6 - Margins
* https://runkit.com/dolanmiu/docx-demo7 - Landscape
* https://runkit.com/dolanmiu/docx-demo8 - Header and Footer
* https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx**
- https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text
- https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text
- https://runkit.com/dolanmiu/docx-demo3 - Bullet points
- https://runkit.com/dolanmiu/docx-demo4 - Simple table
- https://runkit.com/dolanmiu/docx-demo5 - Images
- https://runkit.com/dolanmiu/docx-demo6 - Margins
- https://runkit.com/dolanmiu/docx-demo7 - Landscape
- https://runkit.com/dolanmiu/docx-demo8 - Header and Footer
- https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx**

More [here](https://github.com/dolanmiu/docx/tree/master/demo)

Expand Down Expand Up @@ -88,7 +88,6 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide
[<img src="https://i.imgur.com/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)


...and many more!

---
Expand Down
17 changes: 9 additions & 8 deletions demo/10-my-cv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface Skill {
readonly name: string;
}

interface Achivement {
interface Achievement {
readonly issuer: string;
readonly name: string;
}
Expand All @@ -64,7 +64,7 @@ const experiences: Experience[] = [
{
isCurrent: false,
summary:
"Full-stack developer working with Angular, Node and TypeScript. Working for the iShares platform. Emphasis on Dev-ops and developing the continous integration pipeline.",
"Full-stack developer working with Angular, Node and TypeScript. Working for the iShares platform. Emphasis on Dev-ops and developing the continuous integration pipeline.",
title: "Software Developer",
endDate: {
month: 11,
Expand Down Expand Up @@ -98,6 +98,7 @@ const experiences: Experience[] = [
{
isCurrent: false,
summary:
// cspell:disable-next-line
"Develop web commerce platforms for various high profile clients.\n\nCreated a log analysis web application with the Play Framework in Java, incorporating Test Driven Development. It asynchronously uploads and processes large (2 GB) log files, and outputs meaningful results in context with the problem. \n\nAnalysis and development of the payment system infrastructure and user accounts section to be used by several clients of the company such as Waitrose, Tally Weijl, DJ Sports, Debenhams, Ann Summers, John Lewis and others.\n\nTechnologies used include WebSphere Commerce, Java, JavaScript and JSP.",
title: "Java Developer",
endDate: {
Expand All @@ -118,7 +119,7 @@ const education: Education[] = [
{
degree: "Master of Science (MSc)",
fieldOfStudy: "Computer Science",
notes: "Exam Results: 1st Class with Distinction, Dissertation: 1st Class with Distinction\n\nRelevant Courses: Java and C# Programming, Software Engineering, Artificial Intelligence, \nComputational Photography, Algorithmics, Architecture and Hardware.\n\nCreated a Windows 8 game in JavaScript for the dissertation. \n\nCreated an award-winning 3D stereoscopic game in C# using XNA.",
notes: "Exam Results: 1st Class with Distinction, Dissertation: 1st Class with Distinction\n\nRelevant Courses: Java and C# Programming, Software Engineering, Artificial Intelligence, \nComputational Photography, Algorithms, Architecture and Hardware.\n\nCreated a Windows 8 game in JavaScript for the dissertation. \n\nCreated an award-winning 3D stereoscopic game in C# using XNA.",
schoolName: "University College London",
startDate: {
year: 2012,
Expand Down Expand Up @@ -156,7 +157,7 @@ const skills: Skill[] = [
},
];

const achievements: Achivement[] = [
const achievements: Achievement[] = [
{
issuer: "Oracle",
name: "Oracle Certified Expert",
Expand All @@ -165,7 +166,7 @@ const achievements: Achivement[] = [

class DocumentCreator {
// tslint:disable-next-line: typedef
public create([experiences, educations, skills, achivements]: [Experience[], Education[], Skill[], Achivement[]]): Document {
public create([experiences, educations, skills, achievements]: [Experience[], Education[], Skill[], Achievement[]]): Document {
const document = new Document({
sections: [
{
Expand Down Expand Up @@ -221,7 +222,7 @@ class DocumentCreator {
this.createSubHeading("Skills"),
this.createSkillList(skills),
this.createSubHeading("Achievements"),
...this.createAchivementsList(achivements),
...this.createAchievementsList(achievements),
this.createSubHeading("Interests"),
this.createInterests("Programming, Technology, Music Production, Web Design, 3D Modelling, Dancing."),
this.createHeading("References"),
Expand Down Expand Up @@ -318,8 +319,8 @@ class DocumentCreator {
}

// tslint:disable-next-line:no-any
public createAchivementsList(achivements: any[]): Paragraph[] {
return achivements.map(
public createAchievementsList(achievements: any[]): Paragraph[] {
return achievements.map(
(achievement) =>
new Paragraph({
text: achievement.name,
Expand Down
30 changes: 16 additions & 14 deletions demo/11-declaritive-styles-2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ const table = new Table({
});

const doc = new Document({
numbering:{
config:[{
reference: 'ref1',
levels: [
numbering: {
config: [
{
level: 0,
format: LevelFormat.DECIMAL,
text: '%1)',
start: 50,
}
],
}]
reference: "ref1",
levels: [
{
level: 0,
format: LevelFormat.DECIMAL,
text: "%1)",
start: 50,
},
],
},
],
},
styles: {
default: {
Expand Down Expand Up @@ -184,11 +186,11 @@ const doc = new Document({
spacing: { line: 276, before: 20 * 72 * 0.1, after: 20 * 72 * 0.05 },
rightTabStop: TabStopPosition.MAX,
leftTabStop: 453.543307087,
numbering : {
reference: 'ref1',
numbering: {
reference: "ref1",
instance: 0,
level: 0,
}
},
},
},
],
Expand Down
17 changes: 12 additions & 5 deletions demo/17-footnotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ const doc = new Document({
new Paragraph({
children: [
new TextRun({
children: ["Hello", new FootnoteReferenceRun(1)],
children: ["Hello"],
}),
new FootnoteReferenceRun(1),
new TextRun({
children: [" World!", new FootnoteReferenceRun(2)],
children: [" World!"],
}),
new FootnoteReferenceRun(2),
new TextRun({
children: [" GitHub!"],
}),
],
}),
Expand All @@ -35,15 +40,17 @@ const doc = new Document({
new Paragraph({
children: [
new TextRun({
children: ["Hello", new FootnoteReferenceRun(4)],
children: ["Hello"],
}),
new FootnoteReferenceRun(4),
new TextRun({
children: [" World!", new FootnoteReferenceRun(5)],
children: [" World!"],
}),
new FootnoteReferenceRun(5),
],
}),
new Paragraph({
children: [new TextRun("Hello World"), new FootnoteReferenceRun(6)],
children: [new TextRun("Hello World Again"), new FootnoteReferenceRun(6)],
}),
],
},
Expand Down
2 changes: 1 addition & 1 deletion demo/2-declaritive-styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Example on how to customise the look at feel using Styles
// Example on how to customize the look at feel using Styles
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import {
Expand Down
14 changes: 13 additions & 1 deletion demo/21-bookmarks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
// This demo shows how to create bookmarks then link to them with internal hyperlinks
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Bookmark, Document, Footer, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun, PageReference } from "../build";
import {
Bookmark,
Document,
Footer,
HeadingLevel,
InternalHyperlink,
Packer,
PageBreak,
Paragraph,
TextRun,
PageReference,
} from "../build";

const LOREM_IPSUM =
/* cspell:disable-next-line */
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante.";

const doc = new Document({
Expand Down
3 changes: 1 addition & 2 deletions demo/31-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const doc = new Document({
new TableCell({
children: [
new Paragraph({
text:
"Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
text: "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
heading: HeadingLevel.HEADING_1,
}),
],
Expand Down
Loading

0 comments on commit 601a403

Please sign in to comment.