Skip to content

Commit

Permalink
Merge branch 'release/9.1' into LT-21939
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleenaylor authored Nov 12, 2024
2 parents 1ba0477 + db58ab0 commit e697a61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: NDP461-DevPack-KB3105179-ENU.exe /q

- name: Setup dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
Expand Down
11 changes: 9 additions & 2 deletions Src/xWorks/ConfiguredLcmGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ private static string GenerateSrcAttributeFromFilePath(ICmFile file, string subF
{
filePath = MakeSafeFilePath(file.AbsoluteInternalPath);
}
return filePath;
return (settings.UseRelativePaths || !settings.UseUri) ? filePath : new Uri(filePath).ToString();
}

private static string GenerateSrcAttributeForMediaFromFilePath(string filename, string subFolder, GeneratorSettings settings)
Expand Down Expand Up @@ -3175,6 +3175,8 @@ public class GeneratorSettings
public LcmCache Cache { get; }
public ReadOnlyPropertyTable PropertyTable { get; }
public bool UseRelativePaths { get; }

public bool UseUri { get; }
public bool CopyFiles { get; }
public string ExportPath { get; }
public bool RightToLeft { get; }
Expand All @@ -3186,8 +3188,12 @@ public GeneratorSettings(LcmCache cache, PropertyTable propertyTable, bool relat
{
}


public GeneratorSettings(LcmCache cache, ReadOnlyPropertyTable propertyTable, bool relativePaths, bool copyFiles, string exportPath, bool rightToLeft = false, bool isWebExport = false, bool isTemplate = false)
: this(cache, propertyTable == null ? null : propertyTable, relativePaths, true, copyFiles, exportPath, rightToLeft, isWebExport, isTemplate)
{
}

public GeneratorSettings(LcmCache cache, ReadOnlyPropertyTable propertyTable, bool relativePaths, bool useUri, bool copyFiles, string exportPath, bool rightToLeft = false, bool isWebExport = false, bool isTemplate = false)
{
if (cache == null || propertyTable == null)
{
Expand All @@ -3196,6 +3202,7 @@ public GeneratorSettings(LcmCache cache, ReadOnlyPropertyTable propertyTable, bo
Cache = cache;
PropertyTable = propertyTable;
UseRelativePaths = relativePaths;
UseUri = useUri;
CopyFiles = copyFiles;
ExportPath = exportPath;
RightToLeft = rightToLeft;
Expand Down
7 changes: 4 additions & 3 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public static void SavePublishedDocx(int[] entryHvos, DictionaryPublicationDecor

generator.Init(readOnlyPropertyTable);
IsBidi = ConfiguredLcmGenerator.IsEntryStyleRtl(readOnlyPropertyTable, configuration);
var settings = new ConfiguredLcmGenerator.GeneratorSettings(cache, readOnlyPropertyTable, false, true, System.IO.Path.GetDirectoryName(filePath),
// Call GeneratorSettings with relativesPaths = false but useUri = false because that works better for Word.
var settings = new ConfiguredLcmGenerator.GeneratorSettings(cache, readOnlyPropertyTable, false, false, true, System.IO.Path.GetDirectoryName(filePath),
IsBidi, System.IO.Path.GetFileName(cssPath) == "configured.css")
{ ContentGenerator = generator, StylesGenerator = generator};
settings.StylesGenerator.AddGlobalStyles(configuration, readOnlyPropertyTable);
Expand Down Expand Up @@ -173,7 +174,7 @@ public static void SavePublishedDocx(int[] entryHvos, DictionaryPublicationDecor
Name = CompatSettingNameValues.CompatibilityMode,
// val determines the version of word we are targeting.
// 14 corresponds to Office 2010; 16 would correspond to Office 2019
Val = new StringValue("14"),
Val = new StringValue("16"),
Uri = new StringValue("http://schemas.microsoft.com/office/word")
},
new CompatibilitySetting()
Expand All @@ -183,7 +184,7 @@ public static void SavePublishedDocx(int[] entryHvos, DictionaryPublicationDecor
Val = new StringValue("0"),
Uri = new StringValue("http://schemas.microsoft.com/office/word")
}
// If in the future, if we find that certain style items are different in different version of word,
// If in the future, if we find that certain style items are different in different versions of word,
// it may help to specify more compatibility settings.
// A full list of all possible compatibility settings may be found here:
// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.compatsettingnamevalues?view=openxml-3.0.1
Expand Down

0 comments on commit e697a61

Please sign in to comment.