Bläddra i källkod

Fix for:

Inserting a chart in a template throws exception "Message='rId10' ID conflicts with the ID of an existing relationship for the specified source."

provided by mmirabito.
master
MadBoy_cp 12 år sedan
förälder
incheckning
023338a877
1 ändrade filer med 8 tillägg och 8 borttagningar
  1. 8
    8
      DocX/DocX.cs

+ 8
- 8
DocX/DocX.cs Visa fil

@@ -2748,14 +2748,14 @@ namespace Novacode
private string GetNextFreeRelationshipID()
{
string id =
(
from r in mainPart.GetRelationships()
select r.Id
).Max();
// The convension for ids is rid01, rid02, etc
string newId = id.Replace("rId", "");
int id = (
from r in mainPart.GetRelationships()
where r.Id.Substring(0, 3).Equals("rId")
select int.Parse(r.Id.Substring(3))
).DefaultIfEmpty().Max();
// The conventiom for ids is rid01, rid02, etc
string newId = id.ToString();
int result;
if (int.TryParse(newId, out result))
return ("rId" + (result + 1));

Laddar…
Avbryt
Spara