Procházet zdrojové kódy

Fixed a bug with ReplaceText which was not preserving text formatting.

master
coffeycathal_cp před 15 roky
rodič
revize
33a9b7bcf9
2 změnil soubory, kde provedl 3 přidání a 12 odebrání
  1. 3
    7
      ConsoleApplication3/Program.cs
  2. 0
    5
      DocX/Paragraph.cs

+ 3
- 7
ConsoleApplication3/Program.cs Zobrazit soubor

@@ -12,14 +12,10 @@ namespace ConsoleApplication3
static void Main(string[] args)
{
// Create a document.
using (DocX document = DocX.Load(@"C:\Users\cathal\Downloads\foo.docx"))
using (DocX document = DocX.Load(@"Test.docx"))
{
List<Picture> pictures = document.Pictures;
List<Novacode.Table> imageTable = (from table in document.Tables
where table.Pictures.Count > 0
select table).ToList();
document.ReplaceText("Hio", "World");
document.SaveAs("Test2.docx");
}// Release this document from memory.
}
}

+ 0
- 5
DocX/Paragraph.cs Zobrazit soubor

@@ -1720,11 +1720,6 @@ namespace Novacode
/// <param name="formatting">The text formatting.</param>
public void InsertText(int index, string value, bool trackChanges=false, Formatting formatting = null)
{
#region Default values for optional parameters must be compile time constants.
// Would like to have written 'Formatting formatting = new Formatting())
if (formatting == null) formatting = new Formatting();
#endregion
// Timestamp to mark the start of insert
DateTime now = DateTime.Now;
DateTime insert_datetime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, DateTimeKind.Utc);

Načítá se…
Zrušit
Uložit